In this video, review the template engine Pug.
- [Instructor] Express is prepared to work with…template engine and it's easy to set them up.…To add Pug we obviously first…have to install the module.…For that I'll run npm install--save pug.…Next I will open server dot index js, interestingly…for the template engine, we don't have to require it here,…we will simply, after we instantiate the Express at…app.set view engine with a blank in between pug.…
When we do that, Express will do the rest.…It will simply require Pug then when it needs it.…Next we have to tell Express where to look for the templates…and I will create a dedicated directory for that…in server, I create new folder, and I call it views.…Now after setting the view engine, I add app.set views…and then I want to set the paths in for that.…
I will use the paths module which gives me a few…functionalities to tell to create proper absolute paths…into the file system, so I add const path is require paths,…so that's a core module of no js, nothing to install here.…Back in line seven, here, I now add app.set views…
- 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.