2

I would like to know when to app or route?

and What is the difference between app.use and app.get?

Manfred Tijerino
  • 377
  • 1
  • 3
  • 12
  • app.use and app.get: https://stackoverflow.com/questions/15601703/difference-between-app-use-and-app-get-in-express-js express.Router and app.get: https://stackoverflow.com/questions/28305120/differences-between-express-router-and-app-get – Mebin Joe Feb 04 '19 at 05:30

1 Answers1

2

Following the normal naming conventions, think of app as just another router instance, but the top level one in which you attach all of your other routers to.

The app and router instances share all the capability around middleware and routing. They are very similar.

App has some other methods more relevant to the whole application, like .listen.

Brad
  • 159,648
  • 54
  • 349
  • 530