This repo is functionality complete — PRs and issues welcome!
To get the Node server running locally:
- Clone this repo
terraform init
to install all required module sourceterraform plan and apply
to see the resources to be create and to create infra on AWS
- terraform - To install terraform.
- packer - To install packer.
- AWS cli - to install aws cli only if you are configuring AWS credentials.
In routes/api/index.js
, we define a error-handling middleware for handling Mongoose's ValidationError
. This middleware will respond with a 422 status code and format the response to have error messages the clients can understand
Requests are authenticated using the Authorization
header with a valid JWT. We define two express middlewares in routes/auth.js
that can be used to authenticate requests. The required
middleware configures the express-jwt
middleware using our application's secret and will return a 401 status code if the request cannot be authenticated. The payload of the JWT can then be accessed from req.payload
in the endpoint. The optional
middleware configures the express-jwt
in the same way as required
, but will not return a 401 status code if the request cannot be authenticated.
[![Brought to you by Ayush Jakhmola]