Open mavogel opened 4 years ago
The instructions are not clear how to set up a mongo database easily on localhost to be able to get the project up and running quickly.
mongo
localhost
Prerequisites:
How about adding the following docker-compose.yaml
docker-compose.yaml
version: '3.7' services: mongo: image: mongo:4.2.6 container_name: node-nest-starter-mongo restart: always environment: MONGO_INITDB_ROOT_USERNAME: mongoadmin MONGO_INITDB_ROOT_PASSWORD: secret MONGO_INITDB_DATABASE: bundle-node-nest ports: - 27017:27017 volumes: - ./mongo-init.js:/docker-entrypoint-initdb.d/mongo-init.js:ro
which uses the mongo-init.js to initialize the database accordingly
mongo-init.js
db.createUser( { user: "nestuser", pwd: "nestpwd", roles: [{ role: "readWrite", db: "bundle-node-nest" }] } )
and adapt the .env file in the backend folder as follows:
.env
backend
# Database MONGO_DB_URL = "mongodb://nestuser:nestpwd@127.0.0.1:27017/bundle-node-nest" MONGO_DB_NAME = bundle-node-nest
Then it's possible to ramp up the whole project with the following commands
# Window 1 docker-compose up # Window 2 cd backend && npm install && npm run start:dev # Window 3 cd frontend && npm install && npm start
Would this be an option to add to the starter as well to make the setup easier?
Problem
The instructions are not clear how to set up a
mongo
database easily onlocalhost
to be able to get the project up and running quickly.Solution
Prerequisites:
How about adding the following
docker-compose.yaml
which uses the
mongo-init.js
to initialize the database accordinglyand adapt the
.env
file in thebackend
folder as follows:Then it's possible to ramp up the whole project with the following commands
Would this be an option to add to the starter as well to make the setup easier?