Express.js is not needed to handle HTTP requests. Learn how creating a minimal HTTP server without any external modules will help us to better understand how Express.js works.
- [Instructor] To better understand…what Express provides and does behind the scenes,…let's create a simple HTTP server…without any third-party dependencies.…We will just use pure Node.js.…For this example, I've created a folder called…Webserver in my documents folder…and opened it in Visual Studio Code.…In there let's create a script called…purenodeserver.js,…so I right-click, select New File,…and create a new file called purenodeserver.js.…
And Node.js already comes with a core module…called http, and this module gives us access…to a whole set of functionalities…around doing and receiving HTTP requests.…So let's bring it in by adding const…http equals require http.…And http has a method that lets us create the server.…And I add const server equals http.createServer.…
And createServer also expects a so-called handler function…that is the function that will be called…for each incoming request so I add here,…handler, but handler is not yet defined…so let's create this handler function here.…Above the server creation, I add function handler,…
- 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
Node.js: Build Your First Microservice (2016)with 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.