跳至主要內容

在任何地方執行 JavaScript

Node.js® 是一個免費、開源、跨平台的 JavaScript 執行環境,讓開發者能夠建立伺服器、網頁應用程式、命令列工具與腳本。

// server.mjs
import {  } from 'node:http';

const  = ((, ) => {
  .(200, { 'Content-Type': 'text/plain' });
  .('Hello World!\n');
});

// starts a simple http server locally on port 3000
.(3000, '127.0.0.1', () => {
  .('Listening on 127.0.0.1:3000');
});

// run with `node server.mjs`

透過我們的 學習資源,深入了解 Node.js 的功能。