下載Node.js,官方網址:https://nodejs.org/en/download/
可根據根據自己的電腦配置來下載相當於的Node.js
下載完成後使用Windows鍵+R 輸入cmd
輸入 Node.js,輸入1+1是否出現=2,當出現,那麼你Node.Js就安裝成功了
然後在Visual Studio Code測試代碼
var http=require('http');
http.createServer(function(req,res)
{
res.writeHead(200,{'Content-Type':'text/html;charset=utf-8'});
res.end('我在用Node.JS寫程序');
}).listen(3000,'127.0.0.2')
console.log("Server running at http://127.0.0.2:3000");
最後在瀏覽器中訪問http://127.0.0.2:3000 則顯示