Codebase for the node.js projects.
- Built with Node.js and Express
- Typescript
- Mongoose ODM
- REST API & GraphQL
- Git
- Volta.sh
- Node.js and npm Node >= 18.12 LTS, npm >= 8.19.x - Install with Volta.sh
Route | HTTP Verb | Route Middleware | Description |
---|---|---|---|
/api/healthcheck | GET | isAuthenticated | Show a simple message |
/api/users | GET | isAuthenticated | Get list of users |
/api/users | POST | Creates a new users | |
/api/users/:id | GET | isAuthenticated | Get a single users |
/api/users/:id | DELETE | isAuthenticated | Deletes a user |
The use of endpoints is very simple, previously you could see a table of endpoints that you can call, if you need to create a note or log in, here we have some examples.
Request Body:
{
"email": "[email protected]",
"password": "123456"
}
Response:
{
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJlbWFpbCI6ImNyaXN0aWFuLm1vcmVub0BtYWtlaXRyZWFsLmNhbXAiLCJpYXQiOjE2NjEyMDgwODJ9.kPdMoVUEnyX36vi606Mc1C66yWLKKAB37GLbF0gzhBo",
"profile": {
"firstName": "cristian",
"lastName": "moreno",
"email": "[email protected]",
"avatar": "https://image.com/264.jpg",
"role": "ADMIN"
}
}
Request Body:
{
"firstName": "cristian",
"lastName": "moreno",
"email": "[email protected]",
"password": "123456",
"avatar": "https://image.com/264.jpg",
}
Response:
{
"name": "cristian moreno",
"email": "[email protected]",
"role": "USER",
}
-
Run
npm install
to install server dependencies. -
Configure the env
$ cp .env.example .env
-
Update
.env
with the required info -
Run
npm run dev
to start the development server.