-
-
Notifications
You must be signed in to change notification settings - Fork 17.5k
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
api: Changing arguments based on arity is unclear #2990
Comments
Hi @kevinburkeshyp, it can be confusing, we agree! There is a current discussion in #2896 regarding this issue. If you would like to read the existing discussion, proposals, etc. please feel free to do so and even add your own thoughts, proposals, comments on existing proposals, etc. As for the documentation for the way is works currently, please feel free to create an issue regarding where in the documentation it is confusing, thoughts on what can be added to the documentation, pain points, etc. at https://github.com/expressjs/expressjs.com/issues |
I took a quick look over the documentation on the web site, and I think that they tried to make it clear, but perhaps you can provide a pull request for a suggestion of how to can be clearer. For example, I looked at the documentation and this is what I found:
I'm sure there was some reason you got tripped up in making those connections, and we would absolutely love to hear your feedback at https://github.com/expressjs/expressjs.com/issues on how to make it better & more straightforward. Of course, inlining that information into |
Sorry - I guess I'd expect to see at least one example or code sample that uses the 4 argument form. I clicked thru some of the links but not all of them. I missed the |
(Also sorry for not checking the GH issues before posting - thanks for the link to the other ticket.) |
@kevinburkeshyp that is some great feedback about the website! Can you post the feedback to https://github.com/expressjs/expressjs.com/issues ? |
Calling
app.use
with a function that takes 4 arguments makes Express treat the first argument as aerr
parameter:Calling it with 3 arguments means the first argument is now a
req
and not anerr
:This is misleading - at least it was to me. I can imagine a scenario where someone deletes unused variables from the end of a router ("oh, next/res is unused here, we can delete it"), and accidentally changes the meaning of the other function parameters.
The 4-argument form is also undocumented in
app.use
.The text was updated successfully, but these errors were encountered: