Dallonses logo

Middleware

What is middleware?

Middleware is code that sits in the path between an incoming request and the logic that finally answers it. Each piece does one job, then passes the request along: check the auth token, log the call, parse the body, set CORS headers, catch errors. By the time the request reaches the actual handler, the cross-cutting concerns are already taken care of.

The value is that work shared across many endpoints lives in one place instead of being copied into every handler. Authentication, rate limiting, request logging, and input validation are classic middleware, because every route needs them and none of them is the route's real job. Most server frameworks build on this pattern, where middleware functions form a pipeline and each can inspect, modify, or short-circuit the request. The term also appears in integration platforms, where middleware connects systems that were never designed to talk to each other. A typical API runs every request through an auth middleware that rejects anyone without a valid token before the handler ever sees it, so no individual endpoint has to remember to check.

The order matters. Middleware runs as a chain, so logging before auth and logging after auth produce very different records of what happened.

Middleware at Dallonses

Every API we build runs requests through a clear middleware layer, so auth, validation, and error handling are enforced in one place rather than scattered across dozens of endpoints where one of them will inevitably forget. A handler should contain its business logic and almost nothing else. When the shared concerns live in middleware, a route is easy to read and hard to get wrong, which is exactly what we want under our custom web application development and API-first development work.

Middleware also shines when systems need to be connected rather than built from scratch. An old ERP, a payment provider, a third-party logistics API, none of which speak the same language. A middleware layer translates between them, handles retries and failures, and gives the rest of the system one clean interface to talk to. That is a core part of how we approach integration platforms.

Building an API or stitching systems together? A solid middleware layer keeps the whole thing sane.

Talk to us about your API

Related services


Ready to work together?

Book a meeting
Aymón holding a Tools magazine in front of their facem
Ari working on a laptop outdoors surrounded by plants
Top-down view of a wooden desk with a keyboard, mouse, and headphones
Hand-drawn illustration of a hand snapping fingers
Nico leaning against a water cooler next to a fire extinguishe
Close-up of an open computer with circuit board and components on a wooden desk
Bernat and Andreu collaborating at a desk with monitors and a laptop
Hand-drawn illustration of an open hand waving
Aymón holding a Tools magazine in front of their facem
Ari working on a laptop outdoors surrounded by plants
Top-down view of a wooden desk with a keyboard, mouse, and headphones
Hand-drawn illustration of a hand snapping fingers
Nico leaning against a water cooler next to a fire extinguishe
Close-up of an open computer with circuit board and components on a wooden desk
Bernat and Andreu collaborating at a desk with monitors and a laptop
Hand-drawn illustration of an open hand waving