I was just reading the documentation on express and found these two terms, app.use();
and router.use();
I know app.use();
is used in node for Mounting a middleware at a path, and we often use it in most of the node apps. but what is router.use();
are they both same? if not, whats the difference ?
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.
See Question&Answers more detail:os