How to structure a express.js application?
Is there a common convention for breaking up and modularizing the app.js file in an Express.js application? Or is it common to keep everything in a single file? Chance I have mine broken up as follows: ~/app |~controllers | |-monkey.js | |-zoo.js |~models | |-monkey.js | |-zoo.js |~views | |~zoos | |-new.jade | |-_form.jade |~test | |~controllers | |-zoo.js | |~models | |-zoo.js |-index.js I use Exports to return what's relevant. For instance, in the models I do: module.exports = mongoose.model('PhoneNumber', PhoneNumberSchema); and then if I need to create a phone number, it's as simple as: