Javascript/Sails.js Controller waiting for service to call async function
问题 It is very straightforward to use an asnyc call to wait for a Javascript function to complete, however it appears to be less clear how one should handle a Controller calling a Service which in turn calls an async function. Let's assume that I have a simple asynchronous method: foo.fooMethod( {format: _format, stuff: _stuff }, function( error, response, body ) { if ( error ) { sails.log( error ); res.send( "Error " + error, 500 ); } res.send( body, 200 ); }); In this scenario my async call