This repo is functionality complete — PRs and issues welcome!
To get the Node server running locally:
npm install
to install all required dependenciesnpm run prettier
to have a beautiful codebasenpm run test
to launch ITsdocker-compose up
to launch docker stackmongod
cp .env.example .env
to have access to environement variables (dont forget to change them)npm run start
or yarn start
to start the local servernpm run build
or yarn build
to build the servergit checkout master
git fetch
git pull
git branch -b '(feat|fix|refacto)/branch_name
pull out a branch from master (up to date)git add .
git commit -m 'Your commit'
git push origin (feat|fix|refacto)/branch_name
mongoose-unique-validator
plugin helps us by formatting the error like a normal mongoose ValidationError
.server.ts
- The entry point to our application. This file defines our express server and connects it to MongoDB using mongoose. It also requires the routes and models we'll be using in the application..env
- This folder contains configuration/environment variables (Dont forget to set it up)routes/
- This folder contains the route definitions for our classic API.graphql/
- This folder contains the graphql types, queries, mutations ...models/
- This folder contains the schema definitions for our Mongoose models.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.