Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions pages/getting-started/introduction-to-nodejs.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ server.listen(port, hostname, () => {
});
```

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.

Expand Down