In order to continue to improve our knowledge of Express, we're going to work with the route where we pass variables to and improve our templates.
- [Voiceover] There's still some things…we need to take care of for these pages to be ready.…First, we've got a drop-down right here…that right now shows you only a link…to all the speakers.…Obviously, it would be nice to be able to show…some of the other speakers.…To take care of that, I'm going to go…into my app.js file.…Let's open that up.…Make sure that I create a new locals variable…that has a list of all the speakers.…Now, I'm going to call this one allSpeakers.…And I need to get the data from the data file,…so that is under the variable called dataFile…and then is inside the speakers array.…
So remember, all of this comes…from this data.json document,…and it has an array in there called speakers.…Alright, so once we have that…then let's go ahead and save this.…And we can go into the views,…open up my template which has header.ejs…and that has the drop-down menu.…And then, right after this divider,…I'm going to add some new EJS here.…Remember that when we put something in app.locals…it's available to all of our routes as local variables.…
In this course, Ray Villalobos walks through the process of creating full-featured websites with these technologies. First, find out how to install each package and leverage Node.js features from within Express. Then learn how to build a basic application with templating engines like EJS; create more flexible, modular code with includes and conditional statements; build APIs to manage HTTP requests to add and delete content dynamically; and configure more complex routing. Along the way, Ray implements features like customer feedback forms and real-time live chat, so you can see exactly what Node.js and Express are capable of.
- Handling HTTP requests with Node.js and Express
- Creating and modularizing routes
- Using templates
- Building flexible views
- Creating an API route
- Dealing with POST and DELETE requests
- Creating live chat features with Socket.IO