Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Documentation: Indicate that layers should be added before routes #4053

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
ndarilek opened this issue Apr 29, 2025 · 0 comments
Open

Documentation: Indicate that layers should be added before routes #4053

ndarilek opened this issue Apr 29, 2025 · 0 comments

Comments

@ndarilek
Copy link
Contributor

I ran into an issue where extract run from within server functions failed to extract anything. After lots of head-banging and confusion, I discovered that layers had to be added after routes. So, IOW:

            let router = axum::Router::new()
                .serve_dioxus_application(ServeConfigBuilder::new(), App)
                .layer(Extension(redis))
                .layer(Extension(s3))
                .into_make_service();

instead of:

            let router = axum::Router::new()
                .layer(Extension(redis))
                .layer(Extension(s3))
                .serve_dioxus_application(ServeConfigBuilder::new(), App)
                .into_make_service();

I recognize that this is technically documented on the Axum side, but it's a bit indirect as it needs you to recognize that .serve_dioxus_application is setting up your routes, and that layers need to be added before. Even so, if there's some way to document it on the Dioxus side, or to make the Dioxus server setup immune to this somehow, that'd have saved me a few hours of debugging.

Thanks a bunch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant