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

https://github.com/amrhassanabdallah/rest-api-node

Simple express.js REST API as attempt to apply MVC pattern with node js and learn JWT auth.
https://github.com/amrhassanabdallah/rest-api-node

expressjs jwt-token nodejs rest-api

Last synced: 3 months ago
JSON representation

Simple express.js REST API as attempt to apply MVC pattern with node js and learn JWT auth.

Awesome Lists containing this project

README

          

# Rest API Server

## Architecture
Local server
- Node.js

## Getting Started

### Development local API Server
_Location of server = /server_
Server depends on [node.js LTS Version: v6.11.2 ](https://nodejs.org/en/download/), [npm](https://www.npmjs.com/get-npm),mongo
Please make sure you have it installed before proceeding forward.

Great, you are ready to proceed forward; awesome!

Let's start with running commands in your terminal, known as command line interface (CLI)

###### Install project dependancies
```Install project dependancies
# npm i
```
###### Start the server
```npm start
# node server
```

## Endpoints

### GET Endpoints

#### Get all products
```
http://localhost:3000/products/
```

#### Get favorite restaurants
```
http://localhost:3000/orders/
```

#### Get a product by id
```
http://localhost:3000/products/
```

### POST Endpoints

#### Create a new user
```
http://localhost:3000/users/signup/
```

###### Parameters
```
{
"email": ,
"password": ,
}
```

#### login a user
```
http://localhost:3000/users/login/
```

###### Parameters
```
{
"email": ,
"password": ,
}
```

#### Create a new product
```
http://localhost:3000/products/
```

###### Parameters
```
{
"name": ,
"price": ,
}
```

#### Create a new order
```
http://localhost:3000/orders/
```

###### Parameters
```
{
"productId": ,
"quantity": ,

}
```

### PUT Endpoints

#### Update a product
```
http://localhost:3000/products/
```

###### Parameters
```
{
"propName": ,
"value":
}
```

#### Update a order
```
http://localhost:3000/orders/
```

###### Parameters
```
{
"propName": ,
"value":
}
```

### DELETE Endpoints

#### Delete a product
```
http://localhost:3000/products/
```

#### Delete a order
```
http://localhost:3000/orders/
```

#### Delete a user
```
http://localhost:3000/users/
```

## Middleware
### Authiontication using jwt over orders .