Public | Automated Build

Last pushed: 3 months ago
Short Description
A Node.js API Gateway. Including user authentication, autherization and revese proxy functionality.
Full Description

API Gateway Microservice

Working as a first layer of a microservices application, it provides initialization of user experience by authenticating and then autherizing to use other end microservices by reverse proxing all the request to appropriate services.
Its a plain script for creating an API gateway with close to really basic UI(working on improvements).


  • Docker-engine
  • Mongodb Docker Container


Start Docker Engine and Mongo Container,
docker build --name <username>/api-gateway /path/to/api-gateway's/Dokerfile
in your terminal and then,
docker run -it --link mongo:db <username>/api-gateway bash
This service will work on port 8080.


This microservice communicates with clients and End-Services using HTTP RESTful API mostly GET and POST. The service consumes initial GET and POST Request to authenticate and autherize the users and then storing all the user data in Mongodb Database.
Then for better user experience there are features like,

  • Remember Me
  • Keep me Signed In: If user leaves the application without signing-out
  • Email Verification (In Progress)

For Initialization
GET localhost:8080/

For Singing In
POST localhost:8080/signin
with an application content body in JSON format, it will constitute a password and an Email ID property fields

For Requesting Sign Up Page
GET localhost:8080/signup

FOR Posting Data
POST localhost:8080/signup
This request will constitute four property fields in JSON Format, below is the user database model


Then using Express.js and http-proxy libraries of Node.js, proxying rest of the HTTP request to responsible services
I have used my other microservices for Online Editor and Search as end services with this gateway

//===============Proxy Server Routing==============//
var apiProxy=proxy.createProxyServer();

//=====End Points Address
var editor='http://editor';
var search='http://search';

//=====End Points Routing
//Editor Microservice
app.all('/editor/*',isAuthenticated,function(req,res){'Transferring To Editor Microservice');

//Search Microservice
app.all('/search/*',isAuthenticated,function(req,res){'Transferring To Search Microservice');
  //Persistent websocket connetion to search service,res,{target:search});
Docker Pull Command
Source Repository