Join Daniel Khan for an in-depth discussion in this video Adding routes and logic to a pure Node.js server, part of Building a Website with Node.js and Express.js.
- [Instructor] Right now, we have a web server…that understands exactly one route…that understands exactly one route…that's for the slash or index and it will return…that's for the slash or index and it will return…four-zero-four for anything beyond.…That's not much functionality,…so let's expand this a little bit.…For instance, let's create a route…that will return us the current time.…So, I add a new block with an else-if…enter and look into parsed url dot path name…enter and look into parsed url dot path name…and if it is slash time I will respond with,…and if it is slash time I will respond with,…and if it is slash time I will respond with,…again so, the header 200 from before…again so, the header 200 from before…and then I will use res dot write…and there I will create a new date object…and there I will create a new date object…and with to-string it will give me…and with to-string it will give me…the current date and in the end I will do a res dot end.…
the current date and in the end I will do a res dot end.…
- 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.