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.
- Host: GitHub
- URL: https://github.com/amrhassanabdallah/rest-api-node
- Owner: amrHassanAbdallah
- Created: 2018-06-02T05:17:31.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2025-01-18T07:12:37.000Z (over 1 year ago)
- Last Synced: 2025-02-13T00:52:21.212Z (over 1 year ago)
- Topics: expressjs, jwt-token, nodejs, rest-api
- Language: JavaScript
- Homepage:
- Size: 226 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 33
-
Metadata Files:
- Readme: README.md
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 .