O'Reilly logo

Hands-On Full Stack Web Development with Aurelia by Erikson Haziz Murrugarra Sifuentes, Diego Jose Arguelles Rojas

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Simple HTTP Server

It is time to start coding and see how we can implement a simple HTTP Server using Node.js. So, open your Terminal and in the working directory of your choice, go ahead and create a new folder called my-server:

$ mkdir my-server$ cd my-server

Once you move into the my-server folder, we will need to initialize an NPM module, so run the following command:

$ npm init -y{  "name": "my-server",  "version": "1.0.0",  "main": "index.js",  "scripts": {    "test": "echo \"Error: no test specified\" && exit 1"  },  "keywords": [],  "author": "",  "license": "ISC",  "description": ""}

Now it's time to create the server.js file by executing the touch server.js command in your Terminal. This file will contain the code for our server. We will start ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required