-
Notifications
You must be signed in to change notification settings - Fork 34
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
Chaining [Discussion] #6
Comments
I like the idea to make serve more flexible. The API looks a little awkward since these route middleware is only applied when using serve something like
would fit better |
I think you had a copy and paste error. Did you mean …
I think I would put server after the path since it is required.
If you want to chain handlers before and after this function signature isn't going to work. Maybe something like this:
Thoughts? |
Looks good. When we now call that options we have a nice extension point for server
|
Added a new optional `options` parameter to `serve` function, which allows the caller to include an array of `before` restify handlers and/or an array of `after` restify handlers. This resolves [Issue saintedlama#6](saintedlama#6).
Okay, I've implemented this in my pull request. |
Like Express, Restify allows chaining on path definitions. It would be great if I could pass a chain of callback functions to the quick mapping.
The use case I have in mind is checking authorization on requests.
I use a plugin handler to do the initial authentication handling. Since not all APIs need to be protected, I have a callback function that I use to "protect" a particular path. The path ends up looking like this.
I would prefer to do something like this:
Just like Restify allows, the constructor would allow you to pass or "chain" as many functions as you need.
Thoughts?
The text was updated successfully, but these errors were encountered: