Node.js Windows Example

Firstly, download the msi file from https://nodejs.org/en/

Second, click the msi file to install node.js 

After success, can check like below ,it means install node.js and npm successfully.

Then, create a file named hello.js> go to the hello.js store place and run it like hello.js

hello.js content.

console.log('Hello World!');

Here is the result you will see 

Another sample you can try like below:

firstNodeHttpSample.js content

var http = require('http');

http.createServer(function (req, res) {
    res.writeHead(200, {'Content-Type': 'text/html'});
    res.end('Hello World!');
}).listen(8088);

run it by : node firstNodeHttpSample.js

And check from browser you will see

Refer Link:

https://blog.teamtreehouse.com/install-node-js-npm-windows

 https://www.guru99.com/download-install-node-js.html

原文地址:https://www.cnblogs.com/luffystory/p/10801312.html