correct approach to passing R2D2 database pool to each request? #420
Answered
by
sunli829
catsharkdigital
asked this question in
Q&A
-
Somewhat new to rust and very new to poem, some experience with Axum where a database pool would be passed using an extractor. What's the preferred approach to introducing a database pool to each request? Would it be done with a custom Middleware layer or would another approach be more appropriate? Thanks! |
Beta Was this translation helpful? Give feedback.
Answered by
sunli829
Nov 8, 2022
Replies: 1 comment 1 reply
-
I recommend using poem/examples/openapi/todos/src/main.rs Line 159 in a252560 |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
catsharkdigital
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I recommend using
Data<T>
, in fact this is very similar to Axum.poem/examples/openapi/todos/src/main.rs
Line 159 in a252560