Work toward cross-framework middleware interface
- Dominant language
- Rust
- Stars
- 5.1k
- Forks
- 329
- PR merge metrics
- No merged PRs in 30d
Description
_Originally posted by @rolftimmermans in https://github.com/rustasync/tide/issues/162#issuecomment-482029031_
Having a universal middleware concept in the Rust web-ecosystem is something I look forward to. In the Ruby community, for example, every framework builds on Rack middleware. I see this as the sole factor that allows for (some) code reuse across frameworks.
My questions would be:
* If Actix middleware is different, why is it different? Does Tide middleware offer the same functionality, and could they be mapped to each other? Is it technically possible to move to a common middleware in the future?
* Can we come up with a definition of middleware that is not dependent on any implementation details of the framework? For example I see in the [current Tide middleware definition](https://github.com/rustasync/tide/blob/dc28fd5601d8b8d071de999e080f2c347c3fd61d/src/middleware/mod.rs#L31..L34) that it depends on the DynEndpoint type. Ideally the endpoint itself should also be expressed as a middleware so that no knowledge about endpoints is needed in order to define middleware.
* Maybe the Middleware type and related code needs to be the "core", kind of in the same way that Rust stdlib provides futures, but you need other projects to actually work with them.
Contributor guide
Assessment
This issue has not been assessed yet.