Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

https://github.com/mouracamila/nodejs-crud

This project was developed at RocketSeat Bootcamp 11. API with NodeJs
https://github.com/mouracamila/nodejs-crud

api crud express json nodejs nodemon query rocketseat uuid

Last synced: 7 days ago
JSON representation

This project was developed at RocketSeat Bootcamp 11. API with NodeJs

Awesome Lists containing this project

README

        




CRUD with Nodejs

## Introduction

This is a basic structure for a project management application.

### Technologies used and their definitions:

- **NodeJS**: As an asynchronous event-driven JavaScript runtime, Node.js is designed to build scalable network applications.
- **Express**: Framework for building web applications on top of NodeJS.
- **CRUD**: Acronym for **C**reate, **R**ead, **U**pdate and **D**elete. It is set of operation for servers to execute (POST, GET PUT and DELETE).
- **UUID**: Generator of unique identifiers for objects.
- **Query parameters**: Are a defined set of parameters attached to the end of a url. They are extensions of the URL that are used to help define specific content or actions based on the data being passed. Making filtering and paging possible.
- **JSON**: The json() method of the Body mixin takes a Response stream and reads it to completion. It returns a promise that resolves with the result of parsing the body text as JSON.
- **Nodemon**: Utility that will monitor for any changes in your source and automatically restart your server.

## Installation

1. Clone this Repository:

`$ git clone [email protected]:mouracamila/nodejs-crud.git`

2. Installing dependencies:

`$ yarn`

3. Running project:

`$ yarn dev`

##### Obs: **Yarn** should be run where **package.json** is in your project

#### After running the project, in your terminal, this message should be displayed:

```
[nodemon] starting `node src`
🚀 Back-end started!
```

### Create project

`POST /projects`

#### Parameters

| Name | Type | Required | Description |
| ----- | ---- | -------- | ------------- |
| title | any | Yes | Project title |
| owner | any | Yes | Project owner |

#### Responses

SUCCESS
`Code: 200`

```
{
"id": ,
"title": ,
"owner":
}
```

### List project

`GET /projects?title=&owner=`

#### Parameters

Query parameters.

| Name | Type | Required | Description |
| ----- | ---- | -------- | ------------- |
| title | any | Yes | Project title |
| owner | any | Yes | Project owner |

#### Responses

SUCCESS
`Code: 200`

```
{
"id": ,
"title": ,
"owner":
}
```

ERROR
`Code: 400`

```
{
[]
}
```

### Update project

`PUT /projects`

#### Parameters

| Name | Type | Required | Description |
| ----- | ---- | -------- | ----------- |
| token | any | Yes | Token UUID |

#### Responses

SUCCESS
`Code: 200`

```
{
"id": ,
"title": ,
"owner":
}
```

ERROR
`Code: 400`

```
{
"error": "Project not found."
}
```

### Delete project

`DELETE /projects`

#### Parameters

| Name | Type | Required | Description |
| ----- | ---- | -------- | ----------- |
| token | any | Yes | Token UUID |

#### Responses

SUCCESS
`Code: 200`

```
[]
```

ERROR
`Code: 400`

```
{
"error": "Project not found."
}
```

## License

This project is under license from [MIT](https://en.wikipedia.org/wiki/MIT_License).

---

with ❤ - [MouraCamila](https://github.com/mouracamila)