我正在读express上的文档,发现了这两个术语,app.use();
和router.use();
我知道在一条路径上, node 中使用app.use();
表示Mounting a middleware,我们通常在大多数 node 应用程序中使用app.use();
.但router.use();
是什么?它们都一样吗?如果没有,有什么区别?
I read about router here. I also found similar questions on SO What is the difference between "express.Router" and routing using "app.get"? and Difference between app.all('*') and app.use('/'), but they do not really answer my question. Thanks.