Index

Free, with Google

Keep going, free.

A free account opens lessons 2 and 3 of every track, 33 more lessons, and keeps your progress and review cards on every device.

Start free with Google

A chalk plan

Open everything on chalk.

Every lesson, board, video, lab and paper, and the full review decks. Yearly is $39/year.

See plansStart free instead

Module 01 · Portfolio Projects · Build It Yourself · about 15 min to read

Play it as a journeyTutor comes with a plan

P2: An API with tests and a pipeline

S1 - Build Your Own Database
S1 - Build Your Own Database · Open board

: 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”.

Lesson 9 of 19 in Portfolio Projects

The rest of this lesson is part of a plan.

A plan opens every lesson, board, video, lab and paper on chalk. Yearly is $39/year.

See plansAlready a member? Sign in

Or start free: a free account opens lessons 2 and 3 of every track.

In this lesson

  • CRUD: four actions on one kind of thing
  • Status codes: one number that says what happened
  • Validation: refuse bad input at the door
  • Tests: one test per promise
  • Pipeline: a machine that runs the tests after every push
  • Deploying and the health check
  • What reviewers look for
  • The whole server
  • Choices a reviewer may ask about
  • Secrets in the pipeline

Terms it explains: API, resource, CRUD, method, endpoint, status code, Validation, pipeline, health check, row_to_dict(r),, compaction, log-structured, offset, WAL.

Review Portfolio Projects