Middlewares

 


What do middlewares do?

Middleware functions can perform the following tasks:

  1. Execute any code.
  2. Make changes to the request and the response objects.
  3. End the request-response cycle.
  4. Call the next middleware function in the stack.


middleware do kam karta ha, ya to next ko call karega ya to response bhej dega

koi bhi request aye, middleware hamesa run karega sabse pahale, kio bhedbav nahi

Logger:- kis time pe kon si request ayi hai, uska record ek file me rakhne ke liye

MIDDLEWARE ko hamesa upar hi likhe, nahi to extue nahi hoga.

esko function bana ke bar bar bhi use kar sakte hai


difference b/w next() vs next(err)?



v

0 Comments