The correct order of connections.

middleware is interdependent, for example methodOverride () checks req.body.method to override the HTTP method, however bodyParser () parses the request body and populates req.body. Another example is cookie analysis and session support, we must first use () cookieParser (), followed by session () _.

I wonder how we can find out which middleware should be used before another? I wonder if there is already an ordered list somewhere (a list with all intermediaries in the correct working condition)?

+4
source share
1 answer

The list of middleware for connecting the home page is in the correct order, although it does not explicitly cause dependency.

+1
source

All Articles