Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Well done!
You have completed Express Basics!
You have completed Express Basics!
Preview
Now that we have a custom error handler, let's add a middleware function to handle 404 errors, and send them to the error handler.
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
it will go from one app.use call
to the next looking for a match.
0:00
If it gets to the end without finding
a route and there are no errors,
0:04
Express' native handler will send a 404
back to the client with some plain text.
0:10
If we catch the request before
it gets to the end of the line,
0:17
we can send users a better page.
0:21
Check out Treehouse's 404 page, or Lego's,
0:24
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up