Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/laurabeatris/projects_store

an api for the storage of projects and their tasks. applied all the main concepts of nodejs and express.
https://github.com/laurabeatris/projects_store

api backend express javascript nodejs

Last synced: 22 days ago
JSON representation

an api for the storage of projects and their tasks. applied all the main concepts of nodejs and express.

Awesome Lists containing this project

README

        


GoStack


Challenge from GoStack Bootcamp. Goals: Apply the main concepts of NodeJS


GitHub language count


Made by Laura Beatris

License


Stargazers


About the project   |   
Goals   |   
Licence

## :rocket: About the project

A application to storage projects and their tasks using [Express](https://expressjs.com/pt-br/).

## :ballot_box_with_check: Goals

Apply all the main concepts of NodeJS and Express. How to use global/local middlewares, how to do a CRUD (Create, Read, Update, Delete) and learn the behavior of the requests and responses.

### Routes

- `POST /projects`: This route receives the id and title in the body of the request. Creating a project like this format: `{ id: "1", title: 'NewProject', tasks: [] }`;

- `GET /projects`: This route list all the projects storaged

- `PUT /projects/:id`: This route update a project, receiving the `id` as a route param and the `title` in the request body.

- `DELETE /projects/:id`: This route delete a project, receiving the `id` of the specific project as a route param.

- `POST /projects/:id/tasks`: This route add a task in the project. For this, the `id` of the project is passed as a route param and the `title` of the task is passed in the request body.

### Examples

If i call the route `POST /projects` passing `{ id: 1, title: 'AirHealth' }` e a rota `POST /projects/1/tasks` com `{ title: 'Fix errors' }`, the array of projects should be like this:

```js
[
{
id: "1",
title: "AirHealth",
tasks: ["Fix errors"]
}
];
```

### Middlewares

- `projectsQuantity`: This's a global middleware responsable for (`console.log`) the current count of storaged projects.

- `requestsQuantity`: This's a global middleware responsable for (`console.log`) the current
count of requests made to the api.

- `verifyId`: This's a local middleware responsable for the verification if the id passed as a param has a project related to it. If not, will return a error with `status 404 (Bad Request)`, but if the project exists, the middleware will permit the request to continue normally.

- Crie um middleware global chamado em todas requisições que imprime (`console.log`) uma contagem de quantas requisições foram feitas na aplicação até então;

## :memo: Licence

MIT Licence. See the file [LICENSE](LICENSE.md) for more details.

---

Made with ♥ by Laura :wave: [See my linkedin!](https://www.linkedin.com/in/laurabeatris/)