node.js - Designing a thinner controller in SailsJS -
i new mvc programming.currently have user
model 1 attribute timespent
. using d3.js plot time spent per user in 1 of views. current way implementing incorporating logic of searching database , getting data in correct format in usercontroller
.
from have read on sails docs, recommend "thin" controllers whenever possible. else can incorporate search/formatting code in more reusable manner?
controllers should thin because controllers :) it's common error when start using mvc framework put logic in controller, definetly should't there.
if working data stored in database , related model, suggest logic should in model. many people think, model shouldn't thin possible :)
and of course if not fit there, yann suggested, use services. part of yout application logic should there!
Comments
Post a Comment