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

https://github.com/librity/ignite_todo_middlewares

Rocket Seat - Ignite - NodeJS - Challenge 2 - A to-do list backend made with NodeJS and Express.
https://github.com/librity/ignite_todo_middlewares

challenge express ignite nodejs rest-api rocketseat todolist

Last synced: 3 months ago
JSON representation

Rocket Seat - Ignite - NodeJS - Challenge 2 - A to-do list backend made with NodeJS and Express.

Awesome Lists containing this project

README

          

# Rocket Seat Ignite - To do Backend w/ Middlewares

## Table of Contents

- [About](#about)
- [Getting Started](#getting_started)
- [Endpoints](#endpoints)
- [Resources](#resources)

## About

A to-do list backend made with NodeJS, Express and Jest.

## Getting Started

### Prerequisites

- `node >= 12.0.0`
- `yarn >= 1.22.0`

### Installing

1. Clone this repo locally and install the required packages:

```bash
$ git clone https://github.com/librity/ignite_todo_middlewares.git
$ cd ignite_todo_middlewares
$ yarn install
```

2. Start a dev server:

```bash
$ yarn dev
```

3. Import the Insomnia workspace from `./insomnia/workspace.json`
and run some requests.

### Testing

Run tests with jest:

```bash
$ yarn test
```

## Endpoints

`Users`

- `GET` http://localhost:3333/users/:id
- `POST` http://localhost:3333/users
- `PATCH` http://localhost:3333/users/:id/pro

`Todos`

- `GET` http://localhost:3333/todos
- `POST` http://localhost:3333/todos
- `PUT` http://localhost:3333/todos/:id
- `PATCH` http://localhost:3333/todos/:id/done
- `DELETE` http://localhost:3333/todos/:id

## Resources

- https://rapidapi.com/blog/put-vs-patch/
- https://github.com/uuidjs/uuid#quickstart
- https://stackoverflow.com/questions/18875292/passing-variables-to-the-next-middleware-using-next-in-express-js
- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array
- https://en.wikipedia.org/wiki/List_of_HTTP_status_codes#2xx_success
- https://stackoverflow.com/questions/10865025/merge-flatten-an-array-of-arrays