3

Simple question:

In regards to Express's generator, what is the purpose and benefit behind abstracting app.listen() out of the app.js file and into the ./bin/www file ?

JDillon522
  • 19,046
  • 15
  • 47
  • 81

1 Answers1

4

This makes the app easily testable with supertest, for one thing. This way you can leave your dev server running and still run tests without worrying about TCP port conflicts.

Peter Lyons
  • 142,938
  • 30
  • 279
  • 274