Sunday 21 February 2016

Should we write function coupled to req/res objects?

So I've got a usual express application with the controllers calling functions from Models/Services, etc. E.g. a controller will extract data from req.query and pass those as arguments to a Model's function.My question is, should I write Model's functions to accept the req object instead and do the data extraction? Would that coupling to the req object be safe? Can I later reuse those functions with another Router?

Submitted February 21, 2016 at 12:34PM by kostarelo

No comments:

Post a Comment