Set up your workspace
Create a minimal project and confirm the runtime before writing a server.
Demo lesson · not author-approved.
Check Node.js
Open a terminal and run:
node --version
This tutorial uses Node.js 24 and its built-in HTTP server, test runner, and fetch API. No third-party packages are needed.
Create the project
Create a directory named hello-endpoint, then enter it:
mkdir hello-endpoint
cd hello-endpoint
Create package.json with the following content:
{
"name": "hello-endpoint",
"private": true,
"type": "module",
"scripts": {
"start": "node server.js",
"test": "node --test"
}
}
The type field lets .js files use import and export. The scripts give the project two predictable commands.
Verify the starting point
Run npm test. With no tests yet, the runner should report zero tests. This checks that you are in the right directory and the package file is valid JSON.
Next, you will add a request handler and see the first response in a browser.