Creating Middleware In Actix Web For Rust Developers
Creating middleware in Actix Web involves defining a struct implementing the `Middleware` trait with `forward` & `init` methods. Middleware can be used to wrap services, e.g., checking API keys in request headers.
Introduction This post is going to be a little out of sequence compared to what I've posted here so far. What I've posted here so far are writings I did in 2022 and 2023, as I worked through The Rust Book. However, in the midst of all that, I play with things that are way to big for me. It's just what I do. In the spring and early summer of 2023, I worked through Zero to Production in Rust by Luca Palmieri using the Axum web framework. This a) forced me to learn that framework and b) force me to think when overcoming the differences. As I moved through the book, I felt that Actix Web seemed t...