This is a simple Todo API secured behind JWT authentication from a Redis cache The Todo items themselves and system users are stored in MongoDB
A number of perquisites must be satisifed to run todo-jwt:
- NPM package manger installed
- Redis server installed
- MongoDb server installed
- First clone the GIT Repo and install components:
$ git clone https://github.com/Maltronic/todo-jwt.git
$ cd todo-jwt
$ npm install
- Now generate some SSL keys (requires OpenSSL):
$ mkdir var
$ openssl genrsa -out var/private.pem -aes256 4096
$ openssl rsa -pubout -in var/private.pem -out var/public.pem
(certificate must be password protected)
-
Modify relevant server credentials in the ecosystem.json & config.json files.
-
Choose whether to use the angularjs or reactjs web app by renaming directory "public_angularjs" or "public_reactjs" to just "public".
-
Start the node.js server using a process manager like [pm2] (http://pm2.keymetrics.io/):
$ pm2 startOrRestart ecosystem.json --env dev
After starting the pm2 process manager you can monitor server logs using:
$ pm2 logs
Access to the todo list requires a valid JWT [https://jwt.io/](Java Web Token)
The header should be formatted as follows as per the [https://tools.ietf.org/html/rfc6750#section-2.1](Internet Engineering Task Force) (IETF)'s The OAuth 2.0 Authorization Framework: Bearer Token Usage) preferred Authorization Header Field syntax: Authorisation: Bearer TOKEN