jargon

Comparison

API gatewayvsMiddleware

API gateway

you put one component in front of all the services to do auth, rate limiting and routing once instead of in each of them.

A single entry point handling cross-cutting concerns — authentication, rate limiting, routing, request logging — for services behind it. It removes duplicated middleware and gives one place to enforce policy. It is also a shared choke point and a place for business logic to accumulate where nobody owns it.

Full entry →

Middleware

each function takes the next one and returns a new one, so authentication wrapped logging wrapped the actual handler.

A composable wrapper around a handler that can act before it, after it, or instead of it, stacked into a pipeline. It is the decorator pattern written as functions and assembled as a chain of responsibility, which is why it is the shape every web framework converged on independently. Its recurring difficulty is order: authentication before rate limiting and rate limiting before authentication are different products.

Full entry →

Related comparisons