How can I wrap each API response into a standard reply object in SailsJS?
I'm new to Sails and I'm trying to figure out the best/proper method for returning a standard object for every API response. The container our front-end requires is: { "success": true/false, "session": true/false, "errors": [], "payload": [] } Currently, I’m overwriting the blueprint actions in each controller like this example (which just seems so very, very wrong): find : function( req, res ){ var id = req.param( 'id' ); Foo.findOne( { id : id } ).exec( function( err, aFoo ){ res.json( AppSvc.jsonReply( req, [], aFoo ), 200 ); }); } And in AppSvc.js: jsonReply : function( req, errors, data )