Join Daniel Khan for an in-depth discussion in this video Looping through data, part of Building a Website with Node.js and Express.js.
- [Instructor] Previously we created the middleware…that creates a template variable, that contains…the list of speaker names to be used in our navigation.…It's here in server, index.js.…Here we still have the console.log statement…in there, we will remove it now.…How can we now use it in our layout?…For that I open views, and open the layout,…includes header, file,…because there I have the speakers list.…
So, first of all let's start by fixing all those URLs now.…So, this index.html for Home here,…should also be just a slash.…Further down, /speakers.html,…should be now /speakers…and then we have the speakers list…and we will cover the speakers list in a second.…First, also change /feedback.html,…so simply /feedback.…
Now here starting on line 26 we have the speakers list…that we now want to make dynamic.…And we already have the data available…in the template variable speakerNames.…So, now we want to loop through our speaker array…and for that we use each speaker…in speakerNames,…this will tell how to loop through our speakers.…
- 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
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.