freeCodeCamp.org on YouTube · Open on YouTube
Core skills: building for the web · Advanced beginner · Lesson 21 of 98 · 2 h 26 min video, then about 9 hours of practice
Building an HTTP API with Node.js and Express
After this you can build an Express API with routes, middleware, JSON request bodies and correct status codes.
Why it matters
The other half of a web application is the server that holds data and enforces rules. Node lets you write it in the same language, and Express is the simplest widely used way to define routes and middleware. Focus on routing, reading request bodies and parameters, middleware (what it is and the order it runs in), returning the right status codes, and centralised error handling. Trap: returning 200 with an error message in the body. Status codes are part of your API's contract.
How to use this resource
A current, beginner-friendly course on Node and Express: routing, middleware, a database and error handling.
Go further
Go deeper