From cde0247d084399bd50873ecb4190af933c9daa93 Mon Sep 17 00:00:00 2001 From: Sumit Jha <156579114+devlopersumit@users.noreply.github.com> Date: Sun, 2 Aug 2026 16:46:18 +0530 Subject: [PATCH 1/2] docs: clarify CommonJS and ES module examples in Node.js introduction Added explanation about running the HTTP server examples with CommonJS and ECMAScript modules. Signed-off-by: Sumit Jha <156579114+devlopersumit@users.noreply.github.com> --- pages/getting-started/introduction-to-nodejs.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pages/getting-started/introduction-to-nodejs.md b/pages/getting-started/introduction-to-nodejs.md index f267316..85a446b 100644 --- a/pages/getting-started/introduction-to-nodejs.md +++ b/pages/getting-started/introduction-to-nodejs.md @@ -56,6 +56,8 @@ server.listen(port, hostname, () => { }); ``` +Both examples create the same HTTP server. The first uses the CommonJS module system (`require()`), while the second uses ECMAScript modules (`import`). Which one you use depends on your project's module system and configuration. + To run this snippet, save it as a `server.js` file and run `node server.js` in your terminal. If you use the mjs version of the code, you should save it as a `server.mjs` file and run `node server.mjs` in your terminal. From 8ce698cd78e070e1640c2c5041e31b043ca9a5c2 Mon Sep 17 00:00:00 2001 From: Sumit Jha <156579114+sumitjhacodes@users.noreply.github.com> Date: Sun, 2 Aug 2026 20:34:11 +0530 Subject: [PATCH 2/2] docs: add links for CommonJS and ECMAScript modules Signed-off-by: Sumit Jha <156579114+sumitjhacodes@users.noreply.github.com> --- pages/getting-started/introduction-to-nodejs.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pages/getting-started/introduction-to-nodejs.md b/pages/getting-started/introduction-to-nodejs.md index 85a446b..8377567 100644 --- a/pages/getting-started/introduction-to-nodejs.md +++ b/pages/getting-started/introduction-to-nodejs.md @@ -56,7 +56,7 @@ server.listen(port, hostname, () => { }); ``` -Both examples create the same HTTP server. The first uses the CommonJS module system (`require()`), while the second uses ECMAScript modules (`import`). Which one you use depends on your project's module system and configuration. +Both examples create the same HTTP server. The first uses the [CommonJS modules](https://nodejs.org/api/modules.html) (`require()`), while the second uses [ECMAScript modules](https://nodejs.org/api/esm.html) (`import`). Which one you use depends on your project's module system and configuration. To run this snippet, save it as a `server.js` file and run `node server.js` in your terminal. If you use the mjs version of the code, you should save it as a `server.mjs` file and run `node server.mjs` in your terminal.