Routes : Favourite
File Name : favourite.js
File Path : server/routes/api/favourite.js
Contains route which can create, update, view and delete the user details. These functionalities are included in favourite Controller.
Get Favourite Details Route
- API Path: api/favourites
- Method: GET
- Description: This is a protected route which gets the favourite details through JWT access token which is provided in the header.
Parameters:
- jwtAccessToken: TRUE
- In: Header,
- Type: String,
- Description: JWT access token is used to check the authenticity of the favourite.
Name | Type | Required |
---|---|---|
user | ObjectId | true |
restaurantID | ObjectId | true |
location | ObjectId | true |
product | ObjectId | true |
Response:
Http Code: 200
Data:[ ]
Type: Array
Name | Type |
---|---|
statusCode | Number |
Data | Array |
Description:Data is an Array with all favourite details.
Get Favourite(particular user) Details Route
- API Path: api/favourites/:id
- Method: GET
- Description: This is a protected route which gets the favourite details through JWT access token which is provided in the header.
Parameters:
- jwtAccessToken: TRUE
- In: Header,
- Type: String,
- Description: JWT access token is used to check the authenticity of the favourite.
- id: req.user._id
Response:
Http Code: 200
Data:{ }
Type: Object
| Name | Type | | :--- | :--- | | statusCode | Number | | Data | Object |
Description:Data is an Object with a particular user favourite details.
Post Favourite Details Route
- API Path: api/favourites/
- Method: GET
- Description: This is a protected route which gets the favourite details through JWT access token which is provided in the header.
Parameters:
- jwtAccessToken: TRUE
- In: Header,
- Type: String,
- Description: JWT access token is used to check the authenticity of the favourite.
Response:
Http Code: 200
Data:{ }
Type: Object
Name | Type |
---|---|
statusCode | Number |
Data | Object |
Description:Data is an Object with a favourite details.
Delete Favourite(particular user) Details Route
- API Path: api/favourites/:id
- Method: GET
- Description: This is a protected route which delate the favourite details through JWT access token which is provided in the header.
Parameters:
- jwtAccessToken: TRUE
- In: Header,
- Type: String,
- Description: JWT access token is used to check the authenticity of the favourite.
- id: req.params.id
Response:
Http Code: 200
Data:{ }
Type: Object
| Name | Type | | :--- | :--- | | statusCode | Number | | Data | blank Object |
Description:Data is an empty Object.
Post Favourite Details Route
- API Path: api/favourites/check/product
- Method: POST
- Description: This is a protected route which is used to check whether product is favourite or not through JWT access token which is provided in the header.
Parameters:
- jwtAccessToken: TRUE
- In: Header,
- Type: String,
- id: req.user._id,
- productId: req.body.id,
- Description: JWT access token is used to check the authenticity of the favourite.
Response:
Http Code: 200
Data:{ }
Type: Object
Name | Type |
---|---|
statusCode | Number |
Data | Object |
Description:Data is an Object with a favourite details.