Services Work Learn About Contact
0/8
Lesson 8 of 8

Building a Simple API

You can build APIs using any backend language. The concept is the same: listen for HTTP requests, process them, and return JSON. Here is a simple example using Node.js and Express.

APIS
const express = require("express");
const app = express();
app.use(express.json());

// GET all users
app.get("/users", (req, res) => {
  res.json([{ id: 1, name: "Ali" }]);
});

// POST new user
app.post("/users", (req, res) => {
  const newUser = req.body;
  res.status(201).json(newUser);
});

app.listen(3000);
🧠

Quick Quiz

Answer correctly to unlock the next lesson.

Support the mission

This learning platform is 100% free: no ads, no tracking, no paywalls. If it helped you learn something useful, you can support future lessons or donate to Doctors Without Borders, which provides emergency medical care in crisis zones worldwide.

🎉

You completed APIs & REST!

You finished all 8 lessons and quizzes. You now know the basics of APIs & REST.