Skip to content

Passing vars to routes #344

Answered by jplatte
kellytk asked this question in Q&A
Sep 23, 2021 · 2 comments · 5 replies
Discussion options

You must be logged in to vote

From the example it kind of looks like you want something like this:

let app = Router::new().route("/", get(move |body: Json<Something>| {
    let var = var.clone();
    endpoint::handler(body, var)
}));

but the AddExtension middleware would probably easier to work with.

Replies: 2 comments 5 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
5 replies
@kellytk
Comment options

@jplatte
Comment options

@kellytk
Comment options

@davidpdrsn
Comment options

@kellytk
Comment options

Answer selected by davidpdrsn
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants