Skip to content

sadafshahab12/Books---Restful-Api-

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

You can get book api by this url

Get Book Api: Get Books

get the book api by this Url: Book Api (Res Api)

✅ bookSchema.pre('save', ...) pre means: "Before this action happens..."

'save' means: "Before this document gets saved to MongoDB..."

Yeh ek hook/middleware hai jo Mongoose ke schema ke sath lagta hai.

Ye tab chalta hai jab:

Aap .save() method use karte ho.

Ya new Book({...}).save() karte ho.

✅ function (next) { ... } Ye ek callback function hai jo middleware ke tor pe kaam karta hai.

Isme aap wo kaam likhte ho jo "save" se pehle hona chahiye.

next() ka matlab hai: "ab agla kaam karo, mujhe koi issue nahi."

Releases

No releases published

Packages

No packages published