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

app.use should include a 4-arity example #635

Closed
kevinburkeshyp opened this issue May 9, 2016 · 6 comments
Closed

app.use should include a 4-arity example #635

kevinburkeshyp opened this issue May 9, 2016 · 6 comments
Assignees

Comments

@kevinburkeshyp
Copy link

It was unclear on http://expressjs.com/en/4x/api.html#app.use how you can call app.use with a 4-arity middleware, or where you're supposed to integrate a 4-arity middleware; the error handling docs (http://expressjs.com/en/guide/error-handling.html) cover this, but I also expected to see at least a mention of this behavior in the main app.use docs.

I tried:

  • scanning the docs, checking the arity of all the examples
  • searching using ctrl+f for (err
  • clicking through to "Application settings"

The app.use docs link to the middleware page, which discuss this, but it would be nice if there was at least one example in the Application docs that covered the 4-arity argument, app.use(function(err, req, res, next)).

(at least until expressjs/express#2896 gets resolved)

@kevinburkeshyp
Copy link
Author

(It might also be worth discussing what happens if the middleware throws an unhandled exception in the current or later ticks - in a brief scan of the app.use docs and the middleware docs, it seems like that is not covered)

@crandmck
Copy link
Member

crandmck commented May 9, 2016

It's a god point and a reasonable suggestion. That section has lots of examples, so it should have at least one of error-handling mw.

I'll add something as soon as I have a chance.
@kevinburkeshyp If you're inspired, feel free to open a PR.

@kevinburkeshyp
Copy link
Author

@kevinburkeshyp If you're inspired, feel free to open a PR.

prolly not gonna have time, sorry :(

@hacksparrow hacksparrow self-assigned this Jun 27, 2016
@hacksparrow
Copy link
Member

34cc3f3 fixes this.

@kevinburkeshyp
Copy link
Author

Thanks!

Kevin Burke
925.271.7005 | kev.inburke.com

On Mon, Jun 27, 2016 at 1:18 PM, Hage Yaapa [email protected]
wrote:

Closed #635 #635.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#635 (comment),
or mute the thread
https://github.com/notifications/unsubscribe/AKPN0Zkw0x7M2MXElRcsdXE1ip_ltxqkks5qQDAYgaJpZM4Iajqx
.

@crandmck
Copy link
Member

Thanks @hacksparrow !

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

No branches or pull requests

3 participants