Skip to content

Stuck at implementation of middleware #1113

Discussion options

You must be logged in to vote

You probably don't want to use Rc<RefCell<S>> inside a middleware. Why do you think you need that? Usually we recommend cloning the inner service.

Also if you just wanna write a middleware for your app and don't mind using something axum specific then I recommend https://docs.rs/axum/latest/axum/middleware/fn.from_fn.html. See https://docs.rs/axum/latest/axum/middleware/index.html#writing-middleware for the trade offs.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by SiddheshKanawade
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #1112 on June 22, 2022 12:12.