You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
I want to use axum's layer, but currently, it only supports with_state. If support is added in the future, what would the implementation approach look like? Currently, the code generates main.rs through text replacement. Would it be better for users to create main.rs themselves and use macros to add additional information to the main function?
Describe the solution you'd like
use reqwest::Client;
#[derive(Clone)]
pub struct ApplicationState {
pub fetch: Client,
}
#[tuono::main]
#[tokio::main]
pub fn main() -> tuono::Result<()> {
let fetch = Client::new();
let app_state ApplicationState { fetch };
let middlewares = vec![];
tuono::run(app_state, middlewares)
}
Describe alternatives you've considered
No response
Additional context
No response
The text was updated successfully, but these errors were encountered:
Hey! Thanks for raising this.
I already have something in mind, and I'd love to hear your thoughts on it.
I think the best would be to create a new middleware.rs file. Every file in the same folder or in a nested one are going to be affected by the middleware.
i.e. src/routes/middleware.rs affects all the application endpoints and src/routes/protected/middleware.rs affects just the /protected/* endpoints.
Would that address your suggestion?
We already have a ticket for it in the backlog.
Is your feature request related to a problem? Please describe.
I want to use axum's layer, but currently, it only supports with_state. If support is added in the future, what would the implementation approach look like? Currently, the code generates main.rs through text replacement. Would it be better for users to create main.rs themselves and use macros to add additional information to the main function?
Describe the solution you'd like
Describe alternatives you've considered
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: