where to require a file used in controller or router, at the top scope (require it into a variable and then use that variable) or locally where it is being used?

Any advice with using require in Express files, eg where to require a file used in controller or router, at the top scope (require it into a variable and then use that variable) or locally where it is being used (just require it where used as opposed to other method)?
You already invited:

Floroz

Upvotes from:

I require my routes where I need them because I don't normally need more than one instance anywhere. Controllers and Models I require at the top like any other require, especially the controllers since I will need multiple different exports from them.

If you wanna answer this question please Login or Register