Type : API / Langage : NodeJs / ODM : mongoose / Database : MongoDb / Process manager : PM2 / UnitTest : Mochai /
- RUN WITH DOCKER :
Requirement : [Git, Docker]
- git clone repo
- cp api/config/config_dev.json api/config/config.json
- create machine : docker-machine create default
- on each terminal session : eval $(docker-machine env default)
- docker-compose build --no-cache
- docker-compose up
- get IP of your machine with docker-machine ls
- go to your API http://ip_docker:4242
- RUN WITHOUT DOCKER:
Requirement : [Git, Npm, Node, Mongod, Mongodb]
- git clone repo
- cd api
- cp config/config_dev.json config/config.json and add all credentials
- npm install
- go to api/db/mongo.js, comment FOR DOCKER and uncomment FOR DEFAULT sub line
- node app.js
- INFO:
- you can change listened port in api/config/config.json
- to access container use : docker exec -it ip_docker_machine /bin/bash
- you can modify Mochai test in /api/test
- if you are some obscur error with Docker run delete_docker.sh and rerun docker-compose build --no-cache
- FOR RUN MOCHAI TEST :
PATH: api/test/test.model.js
2 solutions :
-
- in api/Dockerfile comment TO DEFAULT RUN and uncomment TO TEST WITH MOCHAI
-
- docker exec -it ip_docker_machine /bin/bash
- npm test dont take care about Uncaught Error: listen EADDRINUSE 0.0.0.0:4242 it's just cause the app run with pm2