Sunday 28 February 2016

Good examples of separating route controller and model?

I'm using Express.js and was wondering I should have a have a model module for each collection, or try and have a shared model folder for collections that have similar operations. Moreover, I'm unsure if the model methods should read in entire objects i.e. for what will be set, or if i should separate out each of the parameters? Is it ok to have some db calls in the controller? For instance, insertion basically just takes the validated req.body and saves it so abstracting it doesn't seem to save me much as all.Thanks for the advice.

Submitted February 29, 2016 at 05:31AM by -proof

No comments:

Post a Comment