Join Daniel Khan for an in-depth discussion in this video Solution: Finish the speakers detail page, part of Building a Website with Node.js and Express.js.
- [Instructor] Hopefully, you were able…to complete the challenge.…Let's see how I would do it.…So, I first open services and SpeakerService.js,…and in there, I will now add basic function…async getSpeaker, and as argument,…it takes the shortname of speaker.…In there first, as always, we first load…all the data from the JSON file await this.getData,…and next, I will use array find,…so, data.find, and this expects a callback,…which will be a speaker,…and if speaker.shortname equals shortname,…this will evaluate to true, which will give…us that found speaker in our variable speaker.…
If there is no speaker, just return null.…If you found a speaker, we will return title,…which is speaker.title, the name,…speaker.name, the shortname, which is speaker.shortname,…and on the detail page, we show the speaker description,…which is speaker.description.…
Next, we also want to create the function…that gives me the artwork for a given speaker,…so I add async getArtworkForSpeaker,…and again, I want the shortname, this argument.…
- 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
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.