microcule
microcule copied to clipboard
Update node.js function signature
Currently, the signature for Node.js functions is: function (hook).
It would be more clear to users and node.js friendly if the signature was: function(req, res).
The new function signature would actually be backwards compatible, so this wouldn't break any existing services. Update will be required in run-service npm package.
We could also consider function(req, res, next), but implementing next correctly might be non-trivial.
We've got good progress on this in the service-as-middleware branch.
It appears we've got working support for function (req, res, next) signatures to the point where we can chain multiple services together as middlewares.
I've checked in some examples in service-as-middleware for putting a basicAuth service behind others services.
Should be merged into master after more testing downstream in hook.io.