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
Post a Comment