Skip to content

Your first route

Back-End · Free lesson · No account needed

Step 1 of 10 · Start here

Your first route

Start here

A route is the server code for one endpoint. It says: when this method and this path arrive, do this.

app.get('/hello', (req, res) => {
  res.json({ message: 'Hello from the server' })
})

Read it as: when a GET request for /hello arrives, reply with this JSON. That's the shape of Express, the tool most Node.js servers use. You'll write it here on a practice server, with nothing to install.

You’re trying a free lesson. Your progress saves on this device. Create a free account to keep it everywhere and ask the AI tutor.