A progressive Node.js framework for building efficient and scalable server-side applications.
Nest framework TypeScript starter repository.
$ npm install
# development
$ npm run start
# watch mode
$ npm run start:dev
# unit tests
$ npm run test
# seed
$ npm run seed
change .env.example.dev
to .env.stage.dev
and update the values in it.
http://localhost:3000/api-doc
root url - http://localhost:3000
root route - /api/v1/
Endpoint | Method | Description |
---|---|---|
posts/ | GET | Get posts(include filters) |
posts/:id | GET | Get a post |
posts/ | POST | Create a posts |
posts/ | DELETE | Delete a post |
posts/:id | PATCH | Update a post |
Endpoint | Method | Description |
---|---|---|
auth/signup/ | POST | Sign up |
auth/signin/ | POST | Sign in |
auth/forgot-password/ | POST | Request token to change password |
auth/reset-password/ | POST | Reset Password |
field | data_type | constraints |
---|---|---|
id | ObjectId | autogenerated |
string | required and unique | |
password | string | required |
resetToken | string | default='' |
posts | [ ObjectId ] | autogenerated on creation |
field | data_type | constraints |
---|---|---|
id | ObjectId | autogenerated |
title | string | required |
description | string | required |
body | string | required |
user | ObjectId | autogenerated on creation |
- Client sends a request to the API server
- API server checks if the request requires authentication
- If authentication is required, API server checks if the client has a valid token
- If the client has a valid token, API server proceeds with the request
- If the client does not have a valid token, API server sends a 401 Unauthorized response
- If authentication is not required, API server proceeds with the request
- API server processes the request based on the HTTP method (GET, POST, DELETE, or PUT)
- If the request is GET, API server retrieves the resource and sends it back to the client
- If the request is POST, API server creates a new resource and sends a 201 Created response with the URI of the new resource
- If the request is DELETE, API server deletes the resource and sends a 204 No Content response
- If the request is PUT, API server updates the resource and sends a 200 OK response with the updated resource
Note: The client obtains a valid token through an authentication process and sends the token with each request in the Authorization header. The API server validates the token using a token validation service or a similar mechanism.
Nest is an MIT-licensed open source project. It can grow thanks to the sponsors and support by the amazing backers. If you'd like to join them, please read more here.
- Author - Kamil Myśliwiec
- Website - https://nestjs.com
- Twitter - @nestframework
Nest is MIT licensed.