Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

https://github.com/andresilveira1/food-explorer-api


https://github.com/andresilveira1/food-explorer-api

express javascript knex nodejs sqli sqlite sqlite3

Last synced: about 10 hours ago
JSON representation

Awesome Lists containing this project

README

        

Food Explorer Backend

A Rest API build with Node.js and Express. This API have two types of users, a Admin and Customer. The Admin can Create, Edit and delete new dish to menu that contains a Name, image, category, ingredients, price and a description. The Customer can interact with the menu, view details, search, set as favorite and include on a order list.

![preview](./.github/preview.png)

### FrontEnd repository: [Link](https://github.com/andresilveira1/food-explorer-web)

## Technologies

- Node.js
- Express
- SQLite
- Knex
- Cors
- JWT

## Requisites

- [Node.js](https://nodejs.org/en)

## Setup

- Clone the repository;
- Install dependencies (`npm install`)
- Run application (`npm run dev`)


#

HTTP

##

Menu

### POST`/users`

Create a new user.

#### Request body

```json
{
"name": "username",
"email": "[email protected]",
"password": "123456"
}
```

#### Authentication: `/sessions`

```json
{
"email": "[email protected]",
"password": "123456"
}
```

### GET`/menus`

#### Find a dish by query.

```http
/menus?name
```

#### Find a dish by ID.

```http
/menus/:id
```

### POST`/menus`

Create a dish.

#### Request body

```json
{
"name": "dish name",
"description": "dish description",
"price": "12,34",
"category:": "dish category",
"ingredient": ["tag1", "tag2", "tag3"]
}
```

#### Add or update dish image.

```http
PATCH`/menus/img/:id`
```

### PUT`/menus/:menu_id`

Update a dish.

```json
{
"name": "dish name",
"description": "dish description",
"price": "12,34",
"category:": "dish category",
"ingredient": ["tag1", "tag2", "tag3"]
}
```

### DELETE`/menus`

```http
/menus/:menu_id
```

##

Favorites

### GET`/favorites`

```http
/favorites/:user_id
```

### POST`/favorites`

```json
{
"name": "product name"
}
```

### DELETE`/favorites`

```http
/favorites/:id
```

##

Tags

### GET`/tags`

```http
/tags/:menu_id
```

##

Payment

### GET`/payment`

```http
/payment/:user_id
```

### POST`/payment`

```json
{
"quantity": "1",
"menu_id": "1"
}
```

### DELETE`/payment`

```http
/payment/:id
```


[![MIT License](https://img.shields.io/badge/License-MIT-green.svg)](https://choosealicense.com/licenses/mit/)