~/techpuraistart learning
~/tutorials/build-a-rest-api/01-setting-up-the-project
beginner·part 1 of 6·1 min read

Setting up the project

Updated Aug 6, 2026Node.js · Express

Every API in this series starts from the same nine lines of code. Before you touch a route or a database, get that baseline running so you know any errors later come from your own code, not a broken setup.

What you need installed

You'll need Node.js 18 or newer and a terminal. Check your version:

bash
node -v

If that prints something below v18, install a current version before continuing — a few features later in this series rely on newer built-ins.

Initialize the project

Create a folder, initialize npm, and install Express:

bash
mkdir rest-api-tutorial && cd rest-api-tutorial
npm init -y
npm install express

Your first server

Create server.js with the smallest server that can respond to a request:

js
const express = require('express');
const app = express();

app.listen(3000, () => {
  console.log('Server running on http://localhost:3000');
});

Run it with node server.js. Nothing will respond yet — there are no routes — but if the process starts without errors, your setup is correct.

Checkpoint

If node server.js throws Cannot find module 'express', the install step above didn't complete. Re-run npm install express from inside the project folder before moving on.

In the next part, you'll add your first route and get an actual response back from the browser.

next →2. Your first route