This is an API using NodeJs, applying all the content from the first module of NodeJs Formation from Rocketseat.
- HTTP Fundamentals
- Request
- Response
- Headers
- Status Code
- Params
It is a task creator, you can create a task with title and description.
The task consists with a bunch of data, as:
- Id - Id for each task.
- title - Title of task.
- description - Detailed description of each task.
- completedAt - Conclusion date when it's completed. At First, it's started null
- createdAt - Creation date of the task.
- updatedAt - Update date when it has changed.
The GET method show up all the tasks available in the db.
{
"id": "1",
"title": "Create Posts Example",
"description": "This is a example of a Post method from my API using NodeJS",
"completedAt": null,
"createdAt": "2024-08-10T22:49:55.350Z",
"updatedAt": "2024-08-10T22:49:55.350Z"
}The POST method, create a new task in the db
{
"title": "Create Posts Example",
"description": "This is a example of a Post method from my API using NodeJS",
}The PUT method, can change the title or description, or both.
{
"title":"Changing the Title",
"description":"Task to change the title of a task"
}
{
"id": "1",
*"title": "Changing the Title"*,
*"description": "Task to change the title of a task"*,
"completedAt": "null",
"createdAt": "2024-08-10T22:49:55.350Z",
"updatedAt": "2024-08-10T22:59:28.178Z"
}The PATCH method, change the "completedAt" field, from null to the Date it has been completed.
{
"id": "1",
"title": "Changing the Title",
"description": "Task to change the title of a task",
*"completedAt": "2024-08-10T23:01:49.775Z"*,
"createdAt": "2024-08-10T22:49:55.350Z",
"updatedAt": "2024-08-10T22:59:28.178Z"
}The DELETE method, delete the task from the db using the id.