Application.router()
express核心源码模拟
一、express.use()1.1app.use([path,] callback [, callback ...])
通过语法结构可以看到Application.use()参数分别有以下几种情形:
app.use(function(){...}); //给全局添加一个中间件 app.use(path,function(){...}); //给指定路由path添加一个中间件 app.use(function(){...}, function(){...}, ...); //给全局添加n个中间件 app.use(path,function(){...},function(){...}, ...); //给指定路由path添加n个中间件