← Level 3 – Master

Lesson 7 of 10 ⏱ 20 minutes Premium

What a server is and what Node.js is for

Where a website actually lives, what an API is, and why the Level 2 form had nowhere to send its messages.

Remember that form with no recipient?

In Level 2, you built a form that checked a message, said thanks… and then threw the message away. There was nowhere to save it. Your website, so far, can only hand out ready-made files: it can’t receive and remember anything. For that, you need a server. And that’s exactly what you’re about to learn to build.

Frontend and backend

Every big application (Instagram, an online school, an online shop) has two halves:

How do the two halves talk to each other? Through an API (Application Programming Interface): agreed-upon addresses where the backend responds. Here’s a sample conversation:

Frontend:  GET /api/messages         ("Send me all the messages.")
Backend:   [{ "name": "Grandma", "text": "Lovely website!" }]

Frontend:  POST /api/messages        ("Here's data, save it: ...")
Backend:   { "saved": true }

Data is sent in the JSON format: it looks almost exactly like the JavaScript objects you know from the quiz. A lucky coincidence? No. JSON stands for JavaScript Object Notation. It’s on your side.

Where does a backend like that run?

While developing, on your own computer (localhost, you know it from Vite). In production, on a computer that’s always on and connected: either a rented “slice” of a server (a VPS), or a service that handles everything for you (Render, Railway…). We’ll get to deployment in the final lesson.

💡

So what was GitHub Pages for, then? That’s hosting just for the frontend: it hands out files, nothing more. Perfect for a Level 1–2 website (and also the safest: where nothing is running, nothing can be hacked). You need a backend the moment your website has to receive and remember something: messages, sign-ups, users.

Your turn 💪 (a mini-mission out of curiosity)

  1. Open your favorite website, press F12, and switch to the Network tab. Reload the page and watch the waterfall of requests: every line is one conversation between the browser and a server.
  2. Find a GET request in the list, and one that returns JSON (Type column: json or fetch). Click it and look at the response: you’ll see the data the page is built from.
  3. Type this into the console and watch the frontend ask for data on its own:
fetch("https://api.chucknorris.io/jokes/random")
  .then((response) => response.json())
  .then((data) => console.log(data.value));

fetch(...) is the JavaScript command “call an API.” In lesson 9, you’ll use this exact command to connect a form to your own server.

✅

Check yourself: You can explain in your own words the difference between frontend and backend, you know what GET, POST, and JSON are, and you’ve seen in the Network panel how websites talk to each other. In the next lesson, you’ll build a server like this yourself.

What to take away from this lesson