Implement common error pages like 404 for missing pages and 500 for server errors with Express and log errors with Node’s console.
- [Instructor] We're going to use Express'…built-in middleware to implement some error pages…that log to the console.…Then we'll fix that first issue.…Why bother to implement error pages?…It's a best practice to implement custom error pages…in node applications for a couple of reasons.…First, there's the control over the user experience.…It can be very jarring to get a white page…with a little bit of diagnostic information…instead of a nicely themed error page.…Also, in the case of 404s, some sites have a custom…call-to-action that can direct users…to actual content destinations.…
Finally, custom error pages give an opportunity…to implement logging that is contextually appropriate.…For example, you may not want to log a stack trace…if someone goes to a non-existent link in your application.…Let's start with a 404 handler first…and we'll log a warning when it happens…along with the details about the failure.…Switch over to your editor.…I'm gonna close the terminals,…so we can see more of our source code.…In app.js, scroll down to pass the router…
- Building a troubleshooting mindset
- Why measure performance?
- What's a microservice architecture?
- Managing microservices with PM2
- Effective logging strategies
- Debugging Node.js applications
- Benchmarking performance
- Profiling code execution
- Knowing what to optimize
Skill Level Intermediate
1. Build a Troubleshooting Mindset
2. Introducing Microservices
3. Effective Logging Strategies
4. Debugging Node.js Applications
Debugging isn't just logging3m 51s
5. Measuring Performance
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.