Node.js 是為了高效能網路服務而生的 JavaScript 工具包。安裝完成後,可以從最簡單的命令列輸出開始,再建立第一個 Web 服務。
到 Node.js 官網下載並安裝後,在命令列建立 hello.js:
console.log("hello, nodejs.");執行 node hello.js,若看到 hello, nodejs.,代表環境正常。

var http = require("http");
http.createServer(function (request, response) {
response.writeHead(200, { "Content-Type": "text/html" });
response.write("Hello World!");
response.end();
}).listen(8000);啟動 node http.js 後,用瀏覽器訪問 https://localhost:8000/,即可看到 Hello World。

這個流程能幫助初學者快速理解 Node.js 的模組載入、HTTP 伺服器與基本回應機制。