Middleware = interceptor
In the context of gRPC, a middleware is an interceptor. It lies between the code registered by the developers and the actual gRPC framework. When gRPC receives some data from the wire, it will pass this data through the middleware first, and then if it is allowed to go through, the data will arrive in the actual endpoint handler.
These middleware are generally used in order to secure the endpoints against malicious actors or enforce certain prerequisites. An example of securing the API is rate-limiting clients. This is a limit on the number of requests that a client can make in a given timeframe and this is important because it prevents a lot of attacks, such as brute force attacks, DoS and DDoS, and web-scraping. And to enforce a certain prerequisite, we already saw an example where the client needs to be authenticated before being able to call an endpoint.
Before going to see some of the middleware provided by the community, I want to remind you that...