# Express: Routes and Middleware

Express is the most used web framework for Node. Build your first Express app, send and receive JSON, read route and query parameters, write middleware that runs on every request, and organize routes with routers, the shape every Express project you'll meet at work has.

Updated: November 19, 2026

## [Express Basics](https://www.ask-codey.com/courses/nodejs-in-depth/topics/node-express-basics)

1. [Your First Express App: Routes and JSON](https://www.ask-codey.com/lessons/node-express-first-app) (Apprentice): Express turns each endpoint into one line that names its method and path, answers with res.json, and reads a JSON body from req.body once express.json() is switched on, so a small API takes a few lines instead of sixty.
2. [Route and Query Parameters](https://www.ask-codey.com/lessons/node-express-route-and-query-parameters) (Apprentice): A route parameter such as /games/:id lets one route answer every game, read from req.params, and query parameters such as ?players=4 arrive in req.query, both always as text that you turn into numbers before you compare them.

## [Middleware and Routers](https://www.ask-codey.com/courses/nodejs-in-depth/topics/node-express-middleware-and-routers)

1. [Middleware: Code That Runs on Every Request](https://www.ask-codey.com/lessons/node-express-middleware) (Journeyman): Middleware is a function with (req, res, next) that Express runs on a request before the routes, in the order you add it, so a log line, a timer or a body reader is written once instead of in every route.
2. [Organizing Routes with express.Router](https://www.ask-codey.com/lessons/node-express-routers) (Journeyman): An express.Router holds one resource's routes in a file of its own, app.use("/games", gamesRouter) puts them under their path, and app.js exports the app while server.js starts it, so tests can use the app without a port.

## [Exercise: Board Game Shelf API](https://www.ask-codey.com/courses/nodejs-in-depth/topics/exercise-node-board-game-shelf-api)

1. [Exercise: Board Game Shelf API](https://www.ask-codey.com/lessons/exercise-node-board-game-shelf-api) (Apprentice): Finish the board game café's Express API, with a games router that lists the games with filters for group size and playing time, finds one game by its id and adds a game, plus a timing middleware and a JSON 404, and let Supertest's tests check every answer.

Source: https://www.ask-codey.com/courses/nodejs-in-depth/chapters/node-express-routes-and-middleware
