-
Notifications
You must be signed in to change notification settings - Fork 983
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
Adding multiple router handlers #1183
Comments
Try the following: app.get.apply(app, handlers) The http method based route registration function takes a variable amount of functions to run, but not an array of functions. So calling |
I ended up just manually adding them, but I suggest updating the API documentation is apply() is the preferred way to dynamically anonymous functions multiple times, or functions instantiated with new. |
We'll add this to the documentation backlog for the next release. |
Closes: #289 #381 #474 #575 #790 #633 #717 #576 #576 #909 #875 #860 #853 #850 #829 #813 #801 #921 #1101 #1019 #989 #632 #708 #737 #859 #1326 #1327 #927 #1099 #1068 #1040 #1035 #957 #948 #1134 #1136 #1183 #1206 #1286 #1323 > Note: this issue closes _but does not resolve_ the issues listed, we are just tracking them in another medium
I'm trying to add multiple router handlers like so:
However, only the last handler is executed. I tried to add them as two separate parameters instead of an array, and I had the same result. I also tried using the new keyword and had the same results. I can only seem to get multiple handlers to execute when I actually write out the different handlers manually.
The text was updated successfully, but these errors were encountered: