Skip to content

🗃 First NodeJS challenge from Rocketseat's Bootcamp

License

Notifications You must be signed in to change notification settings

yarapolana/nodejs-project-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🗃NodeJS Challenge

This is my first NodeJS server and a code challenge from a class in Rocketseat's Bootcamp. The challenge involves creating a REST API server from scratch using express. Read Description

🚀Description

Build a node server from scratch using Express and Nodemon.

Routes

  • POST /projects: This route creates a new project and must receive id and title in the body. The result will be a json response in the following format: { id: "1", title: 'Novo projeto', tasks: [] }.

  • GET /projects: This route will list all projects with their respective tasks.

  • PUT /projects/:id: This route receives id as a parameter and allows user to update only the project's title.

  • DELETE /projects/:id: This route receives id as a parameter and allows user to delete the project and respective tasks.

  • POST /projects/:id/tasks: This route receives id as a parameter to identify a specific project, and allows user to creat a new array of tasks.

Middlewares

  • Create a middleware that validates if a project with a specific ID exists. This middleware is to be used only on the routes that receive id of the project as a parameter. Return an error if the project does not exist, otherwise, allow the request to function as normal.

  • Create a global middleware that intercepts all requests and prints with a (console.log) the amount of requests made by the application.

Example

If route POST /projects is called with { id: 1, title: 'Novo projeto' } as body and route POST /projects/1/tasks with { title: 'Nova tarefa' }, your response should be an array of projects in the following format:

[
  {
    id: "1",
    title: "Novo projeto",
    tasks: ["Nova tarefa"]
  }
];

Result

To run the application first install dependencies

yarn or npm install

Then run the application

yarn dev

Your code should be up and running here

http://localhost:3000


Check out NodeJS Authentication Challenge here.


License:

This project is made available under the MIT LICENSE.

Authors:

Releases

No releases published

Packages

No packages published