Let's code a web server from scratch with NodeJS Streams!

Click for: original source

Ziad Saab tutorial exploring new technologies abound. In it you will go back to the basics and build a simple web server from scratch with NodeJS. You will review the structure of HTTP requests and responses and get an introduction to Node’s Stream API.

Author explores a simple HTTP server built in NodeJS. This server allows us to listen on an arbitrary port and provide a callback function that will be invoked on every incoming request.

Main points described in detail:

  • Dissecting HTTP
  • Receiving and parsing an HTTP request

By using some lower-level building blocks such as net, Stream, and Buffer, author was able to create a rudimentary HTTP server based on a TCP server and some parsing logic. In the process, you will learn a bit about how HTTP requests and responses work, as well as the basics of readable and writable streams and buffers.

Plenty of code examples. Good read!

[Read More]

Tags javascript programming nodejs servers