1. Install the Nodejs.
Download the installation package to the official website (https://nodejs.org/en/). When the download is complete, click Install. Installed by default in the C:\Program Files\nodejs directory, I choose to install in the E:\nodejs directory.
2. Verify that the installation was successful.
Open the cmd Command Line window, switch to the E:\nodejs directory, dir will see that node and NPM are already installed, enter NODE/NPM-V to view the installed version. If the installation is successful.
3. First Nodejs Web site.
Create a new Helloworld.js file under the Nodejs directory with the following contents:
var http = require ("http");
Http.createserver (function (request, response) {
Response.writehead ($, {"Content-type": "Text/plain"});
Response.Write ("Hello World");
Response.End ();
}). Listen (666);
Console.log ("Nodejs starts to listen 666 port! You can access the Web by http://localhost:666 ");
Enter the command node Helloworld.js, which appears as follows:
Enter http://localhost:666 in the browser address bar to see Hello World
Nodejs Classic Introduction--Hello World