middleware depend on each other, for example methodOverride() checks req.body.method for the HTTP method override, however bodyParser() parses the request body and populates req.body. Another example of this is cookie parsing and session support, we must first use() cookieParser() followed by session()_.
我想知道我们怎么知道应该先使用哪个中间件?我想知道某处是否已经存在一个有序列表(一个包含所有中间件的正确工作顺序的列表)?
最佳答案
connect 上的中间件列表 home page顺序正确,尽管它没有明确指出依赖关系。
关于node.js - connect.js 中间件的正确顺序?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11603701/