-
-
Notifications
You must be signed in to change notification settings - Fork 66
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
Environment check in README documentation is out of date / not working? #28
Comments
The command What is your Edit: Note that the default environment value is |
Hi dpopp07, thanks for the reply. My package.json is looks like:
I believed it was all basically the default stuff, although another team member made it. Also I note a line was missing in my initial post, the Simple Example for expressjs/errorhandler suggests:
I was missing the top line, the most important one. 🤦 Thank you! |
Ah - there is your issue! If you change
to
the example will work. The |
Thank you very much for your help! I'm feeling like this doesn't need to be added to the errorhandler documentation, because it's something everyone knows, or it's something that is covered elsewhere, then. Is that your feeling too? Thanks again! |
You're very welcome!
I don't disagree - I think it's something of a standard for |
Description
The README documentation for errorhandler (under "Simple example") suggests registering the errorhandler like this:
However, when I launch my express.js app with
npm run dev
it does not actually execute that line. Other places I look suggest checking your dev environment like this:if ( app.get('env') === 'development' ) { ...
This does work for me. Which is correct? Are there more addendums to the examples than I realize?
I'm using [email protected].
The documentation in the README is also mirrored to https://expressjs.com/en/resources/middleware/errorhandler.html
Expectations
README documentation should work, as-is.
The text was updated successfully, but these errors were encountered: