davidbanham / express-async-errors

async/await support for ExpressJS
Other
900 stars 43 forks source link

Can I require the module in my app.js file? #19

Closed jcorkhill closed 5 years ago

jcorkhill commented 5 years ago

I'm wondering where the best place to require the module is if my routes and controllers are in separate files.

Should I require it in the same file where I create the Express Application?

Thank you.

kronicker commented 5 years ago

Hi @JamieCorkhill, since we're patching Express#Router it's best to require it before the first use of it. It depends on your structure, but in most use-cases file where you create Espress app is good.