Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update node.js function signature #25

Open
Marak opened this issue Jan 20, 2017 · 1 comment
Open

Update node.js function signature #25

Marak opened this issue Jan 20, 2017 · 1 comment
Assignees

Comments

@Marak
Copy link
Collaborator

Marak commented Jan 20, 2017

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.

@Marak Marak self-assigned this Jan 20, 2017
@Marak
Copy link
Collaborator Author

Marak commented Feb 24, 2017

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant