πŸ’¨ BE TIL Day 8 0323

JBΒ·2022λ…„ 3μ›” 24일
0

CodeCamp BE 02

λͺ©λ‘ 보기
8/30

⬇️ Main Note
https://docs.google.com/document/d/1SA-n3NcyEoU5nVddSYL2QsfVKk15CYRxiD7rmKIMDyA/edit


🐚 Mongo Database

>> Mac Terminal to start MongoDB

brew services : Check the brew that's currently running.
brew services start [file]
brew services stop [file]

>> VS Code Terminal

show databases
use local : I'm telling the computer to go the the local inside the database.
show collections => Call out the data inside the local.
db.product.insert({ seller: "JB", name: "book", price: 5000 }) : literally inserting a new data inside the database with the name of product.

🐚 Docker Composition

There are currently two servers running on: API server and database server.

To group these servers, we're using docker-compose.
--> The port-fowrading between the dockers are automatically held.

>> Commands

docker-compose.yaml : creating the config file
mongo service: API/express service
--> Service : ν•˜λ‚˜μ˜ docker 파일

docker-compose build: building the connection
docker-compose up: operate

  • When docker-compose is operating, there's no need to connect the ports one by one.
  • It's able to access via name of the docker.

🐚 Mongoose

Mongoose is a type of Documental database.

>> Commands

yarn add mongoose
mongoose.connect("mongodb://μ•„μ΄ν”Όμ£Όμ†Œ:포트번호/databaseμ’…λ₯˜")

⬇️ docker-compose.yaml file

⬇️ Sequence

profile
두비두λ°₯λ°₯

0개의 λŒ“κΈ€