Node.js + MongoDB RESTful API Boilerplate

Read Time:47 Second


This is a sample project that I followed the tutorial Build Node.js RESTful APIs in 10 Minutes written by Olatunde Garuba.

How to start

$ docker-compose up -d
$ docker logs -f api

This command will build Node.js API and launch docker container mongo and mongo-express


Node.js API

MethodURLSample Data
POSThttp://localhost:3000/tasks{"name":"Fix issue 1"}
PUThttp://localhost:3000/tasks/1{"name":"Fix issue 1","status":"completed"}

Mongo Express Dashboard

Open browser with http://localhost:8081


Mongoose connection issue

When you download mongo docker image first time, then it may have a delay on initialising. As a result, api may throw connection exception. To resolve this issue, simply restart api container with below command:

$ docker-compose restart api

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.