Amina laabidi
Sep 6, 2021

Middleware has access to the HTTP request and response for each route (or path)

In Express App

what if we want to check somthing before the actual business logic

What if i want to validate login request ?

email or password validation .Here Middleware Functions can help !

Middlewares:

Functions that have access to the request object (req), the response object (res), and the next middleware function in the application’s request-response cycle.

Middleware method has 3 params :request,response and next ;

request : contains info of incoming req

response : object to send response to client

next : method to pass on the flow to next middleware function

Order of Middleware Calls

-
Amina laabidi
Amina laabidi

Written by Amina laabidi

I am a full-stack web developer javascript specialist Front-End

No responses yet