Join Daniel Khan for an in-depth discussion in this video Creating a custom error page, part of Building a Website with Node.js and Express.js.
- [Instructor] If we end up on an unknown page, so far,…we only get some basic error page provided by Express.…We should change that now and add a more professional page…that doesn't look as if the server has just crashed.…So I looked around a little bit…and I found a rather simple template that we can use.…You see it here.…It comes with just a little bit of HTML…and it relies mostly on…external CSS libraries by Bootstrap.…So how can we get this into Pug…for that?…We can simply use…a convertor that we can find online.…
There are plenty of them.…So what I will do now is I will simply, first, copy the HTML…from the template…and then I'll look for HTML…to Pug…convertor…and I will just try the first one here.…I replace the example content with our snippet…and here, we have already proper Pug syntax.…
So I copy that and in my project,…I will now create in Views, a new file, error.pug.…That saved it.…The template also comes with some CSS.…You see there is some…minor CSS included.…So I copy that as well, head over to my project,…
- Creating a server with Express and pure Node.js
- Handling errors in Express
- Creating routes
- Using templates
- Working with the Pug template engine
- Implementing the site structure and logic
- Working with conditionals
- Dealing with POST requests
- Sanitizing user inputs and handling form errors
Skill Level Beginner
Building RESTful Web APIs with Node.js and Expresswith Emmanuel Henri1h 40m Intermediate
Node.js: Build Your First Microservicewith Daniel Khan2h 9m Intermediate
What you should know1m 40s
1. Getting Started
2. Express Basics
3. Getting Started with Our Project
4. Getting Started with Templates
5. Implementing the Site Structure and Logic
6. Handling Form Data
- 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.