September 2024
Beginner to intermediate
985 pages
35h 37m
English
Before we introduce Express.js, let’s briefly review the http package that we used for the Hello World example earlier in the chapter.
Listing 17.19 shows how to create a web server using the http package (https://nodejs.org/api/http.html): after importing the http package, you create a server object using the createServer() method, passing this function a callback function that receives requests to the server and prepares the server's responses to the client. Within this callback function, you have access to an object representing the request to the server (request parameter) and an object representing the response from the server (response parameter).
To generate a response, as ...
Read now
Unlock full access