Skip to content

RajuLohar/restaurant-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

restaurant-api

Description:
demo project on nodejs with express,mongodb and postman.

Project is about crud operations on restaurant and products inside it.
files has src folder which contain all the code:
src/db/mongoose.js => contains database connectivity code
models => conatins 2 file restaurant-model and product-model which have schema of restaurant and product respectively.
routers => contains 2 file restaurant-router and product-router which have code of all the CRUD operations on restaurant and product respectively.
index.js=> It is the main file which connect all the code and it is use to run the whole project.

Installation:
clone the api in the folder,

open the folder in the editor and run "npm install" in the terminal to the path of the folder.

"https://www.getpostman.com/collections/c44b799bd20af12247b6" import this link in the postman to run all the commands.


Usage:
connect to mongodb
oepn postman app
connect to robo 3t or mongodb compass
run "npm run dev" on the terminal in the editor


Run the above commands in the postman to interact with the api:
use the above postman link to setup all the commands


Create restaurant: To create a restaurant document with fields: name,address,picture,openinghours
Read restaurants : To read all restaurants
update restaurant: To update existing restaurant with the objectID
delete restaurant: To delete existing restaurant with the ObjectID


Create product: To create a product document with fields: name,price,photo,category,ownerid
Read products : To read all products of respective restaurant
update product: To update existing product with the objectID
delete delete: To delete existing product with the ObjectID