June 2014
Intermediate to advanced
696 pages
38h 52m
English
You will use Node.js webservers to serve dynamic content more often than you’ll use them to serve static content. This content may be dynamic HTML files or snippets, JSON data, or a number of other types of data. To serve a GET request dynamically, you need to implement code in the request handler that dynamically populates the data you want to send back to the client, write it out to the response, and then call end() to finalize the response and flush the Writable stream.
Listing 7.3 shows the basic implementation of a dynamic webserver. In this case, the webserver simply responds with a dynamically generated HTTP file. The example is designed to show the process of sending the headers, building the response, ...
Read now
Unlock full access