Is there any way to get http object (containing req, res e.t.c) in model.js file or especially in custom remote method like in rails we get an object named 'itself' in the controller which contains all the http object(req, res, env e.t.c).
on debugging I have seen that only args is being passed to remote method(model.js) from http-context.js file.
Try the following as an example:
Model.remoteMethod('custom', {
isStatic: true,
http: { verb: 'get', path: '/custom' },
accepts: [
{ arg: 'req', type: 'object', http: { source: 'req' } },
{ arg: 'res', type: 'object', http: { source: 'res' } }
]
});
@fabien Thanks, it worked... :+1:
Most helpful comment
Try the following as an example: