node.js - How should I structure my node/express/mongodb app? -


i'm curious how people structures node.js app?

usually create models/ views/ controllers/ , that's simple that. i'm kinda new node.js scene , i'm trying learn as can how community works.

any answer welcome, thanks!

for it's worth, actual setup this, until come (or find) better:

lib   db       index.js       model.js       ...   handler       index.js       whatevermakessenseformyparticularwebsite.js       ...   router       index.js       model1restroutes.js       model2restroutes.js       iuroutes.js       ...   config.js (or folder multiple files if makes sense)   server.js (main) public   css   img   js test   ... views   ... 

so yes, models, views, separate routes , actual handlers' implementation. decoupling, dependency injection way. way more testable/mockable.


Comments

Popular posts from this blog

jasper reports - Fixed header in Excel using JasperReports -

media player - Android: mediaplayer went away with unhandled events -

python - ('The SQL contains 0 parameter markers, but 50 parameters were supplied', 'HY000') or TypeError: 'tuple' object is not callable -