This is the backend for a blog written entirely in express/node.js.
- jsonwebtoken authentication
- username and password validation for assigning tokens
- custom middleware checkToken to verify the token and only access to post, delete and put methods.
The api requires the following environment variables to be set:
- PORT= (ex: 8080)
- JWT_KEY= (ex:'something') it is used as the secret key for signing json tokens
- DB_STRING='your mongodb connection string'
- DEBUG="auth,post,api:server' to enable logs via debug module.
Currently there is no route defined to add more users for the jsontoken validation, you have to manually add them to the database, PS: I may add such feature in future.