Chapter 4: Using Web Protocols
Node.js was built with web servers in mind. Using Node.js, we can quickly create a web server with a few lines of code, allowing us to customize the behavior of our server.
This chapter will showcase the low-level core application programming interfaces (APIs) that Node.js provides for interacting with web protocols. We'll start by making HyperText Transfer Protocol (HTTP) requests, creating an HTTP server, and learn how to handle POST requests and file uploads. Later in the chapter, we will learn how to create a WebSocket server and how to create an SMTP server using Node.js.
It's important to have an understanding of how Node.js interacts with underlying web protocols, as these web protocols and fundamental concepts form the basis of most real-world web applications. Later, in Chapter 6, Exploring Node.js Web Frameworks, we will learn how to use web frameworks that abstract the web protocols into higher-level APIs—but having an...