This project aims at creating stateless microservice using Node.js
It contains mainly three services:
-
Authentication Service This service accepts an username which is an email and password and returns a jwt token.
-
JSON Patching Service This service accepts a json object and json patch object and returns an object after patching.
-
Image Resize Service This service accepts an image URL, downloads the image, resize to 50x50 and returns the resized thumbnail.
Contains three services:
-
AuthenticationService
-
ImageThumbnailService
-
JSONPatchService
AuthenticationService
- server.js: Runs Authentication Service
- routes contains
- index.js: Handles the '/login' route
- test contains
- login.spec.js: Contains tests for login route
- config contains
- auth.js: Contains configurations
- winston.js: Contains winston setup for the service
- Dockerfile
- swagger.yaml: Contains swagger specs for Authentication Service API
JSONPatchService
- server.js: Runs JSON Patch Service
- routes contains
- index.js: Handles the '/applyjsonpatch' route
- test contains
- jsonpatch.spec.js: Contains tests for applyjsonpatch route
- config contains
- auth.js: Contains configurations
- winston.js: Contains winston setup for the service
- Dockerfile
- swagger.yaml: Contains swagger specs for JSON Patch Service API
ImageThumbnailService
- server.js: Runs ImageThumbnail Service
- routes contains
- index.js: Handles the '/createthumb' route
- test contains
- createThumbnail.spec.js: Contains tests for createthumb route
- config contains
- auth.js: Contains configurations
- winston.js: Contains winston setup for the service
- Dockerfile
- swagger.yaml: Contains swagger specs for Image Thumbnail Service API
Config contains
- nginx contains
- default.conf: Contains nginx configurations to handle requests to different services
Makefile
Docker-compose-prod-yaml: For production
Docker-compose: For development
- Client makes a request
- Request hits the api server which is a ngnix container
- API server routes the requests to the respective services
- Nodejs >8
- Docker
- NPM
- Clone the repository
- Run
make build-dev
for developement - Run
make build-prod
for production
- Run
make test
-> This will run the linting, tests and gets the code coverage for all the services
http://localhost