Clone the project and run npm install on the terminal. Run npm start to start the server.
To get all the restaurants, use the GET HTTP method and the base url.
To get a specific restaurant, use the GET HTTP method and add the id of the restaurant to the base url. For example:
https://restaurants-api-cdhh.onrender.com/api/restaurant/<restaurant's id>
To register a restaurant, use the POST HTTP method and add the restaurant to the body of the request.
To delete a restaurant, use the DELETE HTTP method and add the restaurant id to the base url.
https://restaurants-api-cdhh.onrender.com/api/restaurant/<restaurant's id>
To get the product list of a restaurant, use the GET HTTP method and first add the restaurant id, then the product id and then the word products. Example:
https://restaurants-api-cdhh.onrender.com/api/restaurant/<restaurant's id>/products
To delete a product from a restaurant, use the DELETE HTTP method and and first add the restaurant's id and then the word products and then product id to the base url. Example:
https://restaurants-api-cdhh.onrender.com/api/restaurant/<restaurant's id>/products/<product's id>
To update restaurant details use the PATCH HTTP method and add the updated restaurant to the body of the request. Example:
https://restaurants-api-cdhh.onrender.com/api/restaurants/<restaurant's id>
To update restaurant's product use the PATCH HTTP method, add the base url the restaurant's id then the word products and then the product id. (The product id should be the same so it could be updated):
https://restaurants-api-cdhh.onrender.com/api/restaurants/<restaurant's id>/products/<product's id>
To add a product to a specific restaurant, use the POST HTTP method, add the restaurant's id to the base url and the the word products, and add the new product to the body of the request:
https://restaurants-api-cdhh.onrender.com/api/restaurants/<restaurant's id>/products/<product's id>
On every restaurant object there is a openingHours prop that will show all the days of the week, and inside of those props there are 2 props: open and close which in each one there is the time of it with the HH:mm format.
On every product object there is a saleInfo prop that behave the same as the restaurant but instead of open and close there are the start and end props that represents the hours of the sale (and again with the HH:mm format)
- Node js
- Express
- Rest API