Build Your First REST API With Node.js and Express
You need a small API. A front end needs a list of tasks, a way to add one, and a way to look one up. The temptation is to reach for a full framework with a database, migrations, and authentication, and to spend the first day configuring it. The better first step is smaller: a Node.js server, Express for routing, and an in-memory list, so you can see the shape of an API before you commit to the machinery around it. The shape is the lesson, and it transfers to every API you build afterwards. A REST API is a set of URLs that each do one thing, using the HTTP verbs the way they were meant to be used. GET reads, POST creates, and the URL names the resource, not the action. /tasks is the collection, /tasks/3 is one task, and the status code says what happened: 200 for a successful read, 201 for a successful creation, 400 for a request the server cannot accept, and 404 for a thing that does not exist. Express adds almost nothing on top of that idea, which is why it is a good first framew...