Node.
js Trail
3º Challenge
Welcome to our third Node JS challenge
P.S.: At the end of this document there are links that can
help in the construction of this challenge.
Introduction
Good job on delivering the last challenge!
## Description
Time to improve your previous code! The challenge this time will be to make
your code from challenge #02 even better by adding some new
functionalities.
### Mandatory Requirements
- Readability
- Private repository
- Small commits
- Commit pattern
- Express
- Readme.md
- Unit testing
- Detailed documentation (readme/swagger) comprising routes and
instructions (how to run your code and so on)
- Input validation (using Joi or Mongoose features)
- JWT Authentication (**For safety reasons, the token should be sent on
headers, not on cookies.**)
- Deploy (see [Deploys](#Deploys))
- Share the repository link with us by email:
#### Scrums
- @ThaisNicodemus :: *[email protected]*
- @LilivHana :: *[email protected]*
#### Node.js instructors
- @RafaelaJaneczko :: *
[email protected]*
- @TiagoDebastiani :: *
[email protected]*
### Optional Requirements
- Docker/Vagrant
- eslint/Prettier
### Deploys
Since Heroku is no longer free, there are some alternatives to deploy like:
- https://vercel.com/
- https://www.netlify.com/
- https://render.com/ (Free tier available)
- https://fly.io/ (Free tier available, with free PostgreSQL)
- https://dokku.com/ (Open source, self-hosted)
## Routes
- Base route: */api/v1*
### Get Routes
#### Get all events: */events*
Example response:
```json
[
{
"_id": "string",
"description": "string",
"dayOfWeek": "monday",
"createdAt": "2022-11-10T14:34:21.682Z"
}
]
```
#### Get events by weekday or id: */events*
Example response (weekday):
```json
[
{
"_id": "string",
"description": "string",
"dayOfWeek": "monday",
"createdAt": "2022-11-10T14:34:21.682Z"
}
]
```
Example response (id):
```json
{
"_id": "string",
"description": "string",
"dayOfWeek": "monday",
"createdAt": "2022-11-10T14:34:21.682Z"
}
```
### Post Routes
#### User signup: */users/signUp*
Example request body (all items required):
```json
{
"firstName": "string",
"lastName": "string",
"birthDate": "2022-11-10",
"city": "string",
"country": "string",
"email": "string",
"password": "string",
"confirmPassword": "string"
}
```
#### User signin: */users/signIn*
Example request body (all items required):
```json
{
"email": "string",
"password": "string"
}
```
#### Create event: */events*
Example request body (all items required):
```json
{
"description": "string",
"dayOfWeek": "monday",
"createdAt": "2022-11-10T14:47:32.962Z"
}
```
### Delete Routes
#### Delete event by id or weekday: */events*
## IMPORTANT
**First and foremost, you must develop your code. Plagiarism is an ethical
infraction and goes against the company standards, therefore if it's
identified in a code the deliver will not be considered.**
**The parameters should be passed via query and filtered so the request can
be identified and the expected response is returned.**
**The createdAt doesn't need to be added manually, so the field can be
excluded from the models, the better way to implement this feature is to
toggle the timestamps options on the models and return the field on the
response.**
**The _id field is implemented automatically by Mongo, therefore adding a
manual field for the id would be useless.**