P2: An API with tests and a pipeline

: the board shows a program that takes commands and keeps records safe. The API in this lesson is a small front door on top of the same idea: a request comes in, a record is stored, an answer goes out.
Asha Rao (a made-up learner, so her numbers are teaching values) has the page and the tool from P1: A site and a tool, shipped. She applies for a backend job. The hiring engineer writes back with one line: “Do you have a project with an API, tests, and something that runs on a server?” She has none of the three. A tool that runs on her own laptop does not answer that question.
An API (application programming interface) is a program that other programs talk to over the network, with fixed messages. Here the messages are HTTP requests, the same kind a browser sends. By the end of this lesson you will be able to build a small REST API that creates, reads, updates and deletes records, prove it with tests that run on every push, deploy it, and know what a reviewer checks first.
The history (optional)
Roy Fielding described REST (Representational State Transfer) in Chapter 5 of his doctoral dissertation, “Architectural Styles and the Design of Network-based Software Architectures”, at the University of California, Irvine in 2000. He used it to explain why the web scaled. Its main idea is a uniform interface: every thing on the server has a name, and a small fixed set of actions works on all of them. Most “REST APIs” today use only part of it. Nothing later depends on this history.
Before you start. P1: A site and a tool, shipped gave you a tool that returns an exit code and tests that run with one command. A repo a stranger can judge in two minutes gave you the README that a stranger reads in two minutes. HTTP 04: Routing and Response showed that a server reads a request and picks an answer by its path. The Assembly Line (CI/CD) showed a machine that runs your checks after each commit. You need to have read one request, such as GET /tasks/1, as “a method and a path”.