Building A

Simple Node.js HTTP server


Introduction

A simple http server written in Node.js. It uses only the bult in modules (NOT Express.js, etc !)

This is an exercise to understand the basics before progressing to use Express.js or other frameworks / API's.

Inspiration

The code for the most part is from the following YouTube tutorial from Traversy Media:

In my opinion, this is one of the best videos of it's type online. It goes into detail and makes it easy to understand the core principles behind the code. Most videos just start using Express straight away but I do like to understand the inner workings BEFORE I use external modules, libraries etc.

What is node?

Node.js is a server side runtime environment that allows us to use the v8 engine used within Google Chrome to run JavaScript on the server. This is pretty neat as we can use the same language we use to manipulate the DOM on the client machine to manipulate the data and respond to the client requests on the server. A one language, full stack solution.

Further more, it's asynchronous (non-blocking) which not only makes it efficient and fast but makes it easy to scale up and adapt to changes in demand.