[英]expressjs middleware next function vs response objects next function
I recently noticed an undocumented next
function on the expressjs response object. 我最近注意到expressjs 响应对象上有一个未记录的
next
函数。
Is that function the same as next
in the middleware function(req, res, next)
? 该功能与中间件
function(req, res, next)
next
功能相同吗?
Is its use discouraged because it is undocumented? 是否因为未记录而阻止其使用?
Yes, it is the same function as can be seen here in the source code . 是的, 它与源代码中的功能相同 。
Yes, I would say it's use is discouraged because it is undocumented and also unnecessary since each middleware function will get next
passed in as the 3rd argument. 是的,我不鼓励使用它,因为它没有记录,也没有必要,因为每个中间件函数都会作为
next
参数传入next
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.