Skip to content

Dockerized Node.js + MongoDB demo app featuring a small rest API

License

Notifications You must be signed in to change notification settings

wescosta/nocker-demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Nocker Demo

A Dockerized Node.js + MongoDB demo app featuring a simple blog rest API.

Run it

Note: In order to run this project you must have Docker installed.

To run it, simply execute the docker-compose up command and docker-compose stop to stop the application. If you wish to stop and remove the container, you may do so by running docker-compose down.

Once the app is running, open your browser on http://localhost.

Scale it up or down

With the docker-compose scale command, it is very simple to scale your app up or down.

Example:

docker-compose scale api=5 web=2

Proxy and Load balancer

There are two web servers running, one to serve the web app and its static artifacts and another to serve the express rest API. For that we use Nginx is configured as a reverse proxy and a load balancer. Thus requests to http://localhost are redirected to the web app and requests to http://localhost/api are routed to the api.

API Endpoints

Posts

  • GET /api/{id} - Loads a single blog post by id
  • GET /api/{page}/{limit} - Loads paginated blog posts
  • DELETE /api/{id} - Deletes a blog post
  • PUT /api/{id} - Updates a blog post by id - body schema
  • POST /api/{id} - Creates a new blog post - body schema

Utililty

Tooling Used

The following tools were used on this demo:

About

Dockerized Node.js + MongoDB demo app featuring a small rest API

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published