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

posted @ 2019-05-01 23:58  Happy2Share  阅读(174)  评论(0编辑  收藏  举报