GithubHelp home page GithubHelp logo

yarapolana / nodejs-project-api Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 2.12 MB

🗃 First NodeJS challenge from Rocketseat's Bootcamp

License: MIT License

JavaScript 100.00%
rocketseat-desafio01 nodejs nodejs-server rocketseat-bootcamp express

nodejs-project-api's Introduction

🗃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:

nodejs-project-api's People

Contributors

yarapolana avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.