Skip to content

Build a REST API from nothing

BasicsBuild alongNode + ExpressYou need: Node installed, a terminal
What you’ll build: A small users API. Seven steps, one small change each, and a command after every step to prove it works.GET /healthGET /usersPOST /usersGET /users/:id
Step 1 of 7

Start an empty project

Make a folder, create a package.json, and install Express, a small library that turns “a request came in” into a function you write.

WHY

package.json records what your project depends on, so anyone can rebuild it with npm install.

No code yet. This step runs 3 commands:
terminal
$ mkdir users-api && cd users-api
$ npm init -y
$ npm install express