We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
app.use()的原理
app.use()加载用于处理http请求的middleware(中间件),请求会一次被middlewares处理
function middleware(req, res, next) { // 做点什么 // 调用下一个 next() }
原理就是,express维护了一个函数数组, 实现了一个next()方法,从函数数组中依次取出函数,并把next作为传参。
The text was updated successfully, but these errors were encountered:
No branches or pull requests
app.use()加载用于处理http请求的middleware(中间件),请求会一次被middlewares处理
原理就是,express维护了一个函数数组,
实现了一个next()方法,从函数数组中依次取出函数,并把next作为传参。
The text was updated successfully, but these errors were encountered: