Back end API for Feed-me website which helps your find the restaurants around you
Rename "config/dev.env.env" to "config/dev.env" and update the values/settings to your own
npm install
# Run in dev mode
npm run dev
# Run in prod mode
npm start
- The app is launched to heroku : feed-me
Admin CRUD operations
Create a new user
Endpoint:
Method: POST
Type: RAW
URL: https://sameh-feed-me.herokuapp.com/api/v1/admin
Headers:
Key | Value | Description |
---|---|---|
Content-Type | application/json |
Body:
{
"name" : "hello",
"email" : "[email protected]",
"password" : "123456"
}
Delete a user by id
Endpoint:
Method: DELETE
Type:
URL: https://sameh-feed-me.herokuapp.com/api/v1/admin/611ab2e3d18a4c075b72bafa
Fetch a user by id
Endpoint:
Method: GET
Type:
URL: https://sameh-feed-me.herokuapp.com/api/v1/admin/611ab2d9d18a4c075b72baf8
Fetch all users in the database
Endpoint:
Method: GET
Type:
URL: https://sameh-feed-me.herokuapp.com/api/v1/admin
Query params:
Key | Value | Description |
---|---|---|
sort | -createdAt | |
skip | 1 | |
limit | 1 |
Update a user by id
Endpoint:
Method: PUT
Type: RAW
URL: https://sameh-feed-me.herokuapp.com/api/v1/admin/611ab2d9d18a4c075b72baf8
Headers:
Key | Value | Description |
---|---|---|
Content-Type | application/json |
Body:
{
"name" : "edited"
}
Restaurants CRUD operations
Create a new restaurant
Endpoint:
Method: POST
Type: RAW
URL: https://sameh-feed-me.herokuapp.com/api/v1/restaurants
Headers:
Key | Value | Description |
---|---|---|
Content-Type | application/json |
Body:
{
"name" : "Adam Cafe2",
"email" : "[email protected]",
"address" : "shobra millis zefta",
"averageRating" : 8
}
Delete a restaurant by id, Requires an authenticated user.
Endpoint:
Method: DELETE
Type:
URL: https://sameh-feed-me.herokuapp.com/api/v1/restaurants/6118604f91f10dbc32670992
Fetch all restaurants in the database
Endpoint:
Method: GET
Type:
URL: https://sameh-feed-me.herokuapp.com/api/v1/restaurants
Endpoint:
Method: GET
Type:
URL: https://sameh-feed-me.herokuapp.com/api/v1/restaurants/radius
Query params:
Key | Value | Description |
---|---|---|
lat | 30.852144 | |
lon | 31 | |
radius | 50 |
Update a restaurant by id, Requires an authenticated user.
Endpoint:
Method: PUT
Type: RAW
URL: https://sameh-feed-me.herokuapp.com/api/v1/restaurants/611ab3cbd18a4c075b72bb23
Headers:
Key | Value | Description |
---|---|---|
Content-Type | application/json |
Body:
{
"name" : "edited"
}
Update restaurant picture
Endpoint:
Method: PUT
Type: FORMDATA
URL: https://sameh-feed-me.herokuapp.com/api/v1/restaurants/611ab3cbd18a4c075b72bb23/photo
Body:
Key | Value | Description |
---|---|---|
file |
Fetch a single restaurant by id
Endpoint:
Method: GET
Type:
URL: https://sameh-feed-me.herokuapp.com/api/v1/restaurants/611ab3cbd18a4c075b72bb23
CRUD operations for reviews , Publishers aren't allowed to post reviews, only users can do that.
Create a review for a restaurant , requires user role and authentication.
Endpoint:
Method: POST
Type: RAW
URL: https://sameh-feed-me.herokuapp.com/api/v1/restaurants/611ab3cbd18a4c075b72bb23/reviews
Headers:
Key | Value | Description |
---|---|---|
Content-Type | application/json |
Body:
{
"title" : "bad restaur",
"text": "hate every thing",
"rating" : 7
}
Delete a review , requires authentication
Endpoint:
Method: DELETE
Type:
URL: https://sameh-feed-me.herokuapp.com/api/v1/reviews/611ac868ea5b915230f0d1fa
Fetch a single review by id
Endpoint:
Method: GET
Type:
URL: https://sameh-feed-me.herokuapp.com/api/v1/reviews/611ac0a36029ca31bea1336a
Fetch all the reviews in the database
Endpoint:
Method: GET
Type:
URL: https://sameh-feed-me.herokuapp.com/api/v1/reviews
Fetch all reviews for a specific restaurant
Endpoint:
Method: GET
Type:
URL: https://sameh-feed-me.herokuapp.com/api/v1/restaurants/611ab3cbd18a4c075b72bb23/reviews
Update a review , requires authentication.
Endpoint:
Method: PUT
Type: RAW
URL: https://sameh-feed-me.herokuapp.com/api/v1/reviews/611ac866ea5b915230f0d1f4
Headers:
Key | Value | Description |
---|---|---|
Content-Type | application/json |
Body:
{
"rating":10
}
Servings CRUD operations
Create a serving for a specific restaurant , requires publisher role and authenticated user .
Endpoint:
Method: POST
Type: RAW
URL: https://sameh-feed-me.herokuapp.com/api/v1/restaurants/611ab3cbd18a4c075b72bb23/servings
Headers:
Key | Value | Description |
---|---|---|
Content-Type | application/json |
Body:
{
"name" : "crep4",
"price" : 50,
"components" : ["katchap" , "bread" , "chicken"],
"description" : "syrian good crep"
}
Delete a serving , requires publisher role and authenticated user .
Endpoint:
Method: DELETE
Type:
URL: https://sameh-feed-me.herokuapp.com/api/v1/servings/611ab3ddd18a4c075b72bb2b
Fetch all servings
Endpoint:
Method: GET
Type:
URL: https://sameh-feed-me.herokuapp.com/api/v1/servings
Fetch all servings of a specific restaurant
Endpoint:
Method: GET
Type:
URL: https://sameh-feed-me.herokuapp.com/api/v1/restaurants/611861b55ee30ec300cd5e5d/servings
Fetch serving by id
Endpoint:
Method: GET
Type:
URL: https://sameh-feed-me.herokuapp.com/api/v1/servings/611ab3d9d18a4c075b72bb27
update a serving , requires publisher role and authenticated user .
Endpoint:
Method: PUT
Type: RAW
URL: https://sameh-feed-me.herokuapp.com/api/v1/servings/611ab3ddd18a4c075b72bb2b
Headers:
Key | Value | Description |
---|---|---|
Content-Type | application/json |
Body:
{
"name" : "edited"
}
Users CRUD operations
Create a new user
Endpoint:
Method: POST
Type: RAW
URL: https://sameh-feed-me.herokuapp.com/api/v1/users/signup
Headers:
Key | Value | Description |
---|---|---|
Content-Type | application/json |
Body:
{
"name":"user",
"email" :"[email protected]",
"password" : "123456"
}
Delete authenticated user's account
Endpoint:
Method: DELETE
Type:
URL: https://sameh-feed-me.herokuapp.com/api/v1/users/deleteuser
This route is for resetting your forgotten password, It sends an email to your email address which contains a link to your reset password page
Endpoint:
Method: POST
Type: RAW
URL: https://sameh-feed-me.herokuapp.com/api/v1/users/forgotpassword
Body:
{
"email" : "[email protected]"
}
Fetch the authenticated user's details
Endpoint:
Method: GET
Type:
URL: https://sameh-feed-me.herokuapp.com/api/v1/users/me
Endpoint:
Method: POST
Type: RAW
URL: https://sameh-feed-me.herokuapp.com/api/v1/users/login
Headers:
Key | Value | Description |
---|---|---|
Content-Type | application/json |
Body:
{
"email" :"[email protected]",
"password" : "123456"
}
Logout user , Clear cookies
Endpoint:
Method: POST
Type:
URL: https://sameh-feed-me.herokuapp.com/api/v1/users/logout
Reset password route
Endpoint:
Method: PUT
Type: RAW
URL: https://sameh-feed-me.herokuapp.com/api/v1/users/resetpassword/2764ebbbfa2d41e72fe8de3b239b7f24e1165ea2
Body:
{
"password" : "1235456"
}
Update authenticated users's password, current password and new password are needed
Endpoint:
Method: PUT
Type: RAW
URL: https://sameh-feed-me.herokuapp.com/api/v1/users/updatepassword
Body:
{
"currentPassword": "1234A56",
"newPassword" : "123456"
}
Update authenticated user's details
Endpoint:
Method: PUT
Type: RAW
URL: https://sameh-feed-me.herokuapp.com/api/v1/users/updatedetails
Headers:
Key | Value | Description |
---|---|---|
Content-Type | application/json |
Body:
{
"name" : "edited",
"email":"[email protected]"
}
Available Variables:
Key | Value | Type |
---|---|---|
url | https://sameh-feed-me.herokuapp.com |
Made with ♥ by thedevsaddam | Generated at: 2021-08-17 00:58:56 by docgen