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
In a real world example, my state would contain the database pool from sqlx and the info_middleware would do things like ensure token is valid, extract IP address, User agent etc. and make it available to all handlers.
For routing, basically:
"/" is to take user to home_get
"/assets/favicon.ico" serves the favicon file in the assets folder, and
any other routes is to fallback to home_get.
1 and 2 work well. 3 does not.
For example, "/submit" fails with below 500 Internal error:
Missing request extension: Extension of type `fallbackdemo::MyConnectionInfo` was not found. Perhaps you forgot to add it? See `axum::Extension`.
I think this is because the Extension middleware isn't accessible to fallbacks?
How to make it work? Or some workaround (other than having to specify every single fallback route manually)?
The text was updated successfully, but these errors were encountered:
I have the following simple code:
In a real world example, my
state
would contain the database pool fromsqlx
and theinfo_middleware
would do things like ensuretoken
is valid, extract IP address, User agent etc. and make it available to all handlers.For routing, basically:
"/"
is to take user tohome_get
"/assets/favicon.ico"
serves the favicon file in the assets folder, andhome_get
.1 and 2 work well. 3 does not.
For example,
"/submit"
fails with below 500 Internal error:I think this is because the Extension middleware isn't accessible to fallbacks?
How to make it work? Or some workaround (other than having to specify every single fallback route manually)?
The text was updated successfully, but these errors were encountered: