Node.js and Express.js REST API with MongoDB services Docker compose file.
Switch branches/tags
Nothing to show
Clone or download
Alex Bejan
Alex Bejan Merge branch 'master' of
* 'master' of
  Delete README
Latest commit 5c3259a Mar 7, 2017
Failed to load latest commit information.
.gitignore initial commit Mar 7, 2017
LICENSE Initial commit Mar 7, 2017 updated readme Mar 7, 2017
docker-compose.yml initial commit Mar 7, 2017


Node.js and Express.js REST API with MongoDB services Docker compose file. You can use this for launching a REST api on your server very quickly. It will create a MongoDB database with admin and database users and a REST service that will allow you to get and send data from Mongo. It will expose 2 ports, one for connecting directly to Mongo and one for the API. The configuration is done through Environment variables which you can add in a .env file in this folder since it's already present in .gitignore so it won't be committed if you push this code to your fork. You can view a step-by-step tutorial with how this file was created on my Blog


Docker and Docker compose are required to run these services.

Running the services

Environment variables

Either export each environment variable in the terminal session or add an .env file in this folder after cloning it. The following environment variables are available:

  • MONGODB_EXPOSED_PORT (the MongoDB port you will expose to the outside world)
  • MONGODB_ADMIN_USER (MongoDB admin user)
  • MONGODB_ADMIN_PASS (MongoDB admin password)
  • MONGODB_APPLICATION_DATABASE (MongoDB database for the REST Api Node.js application)
  • MONGODB_APPLICATION_USER (MongoDB REST Api database user)
  • MONGODB_APPLICATION_PASS (MongoDB REST Api database password)
  • REST_API_APIKEY (REST Api Key that you will need to include as a URL parameter when making HTTP requests)

Here is an example of my .env file I used for the Blog example.