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 ...

Get Node Cookbook - Fourth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.