Skip to main content
Filter by
Sorted by
Tagged with
2 votes
1 answer
27 views

How to create an Axum Body from an OpenDAL reader?

I need to build an Axum Body from an OpenDAL reader, but I can't find any way to achieve it. Does anybody know how to do it? Sample code: use axum::body::Body; use opendal::{services, Operator}; use ...
Francesco Cina's user avatar
0 votes
0 answers
83 views

Serving static files in Axum?

I'm trying to adopt the approach in Rust on Nails to be a little simpler. I don't need to serve static files with a cash-buster, but I do need to find a way to serve them. If I'm understanding ...
McBoatface et al.'s user avatar
2 votes
1 answer
51 views

Do axum handler arguments need to be in order?

I am making a simple API in Rust. I have a middleware that will extract the token and pass it as extension. The only problem I had was if my handler was like this: pub async fn add_task<T: ...
Simone Samardzhiev's user avatar
0 votes
1 answer
46 views

service static folder from root without fallback_service

I need to serve a folder created by vitejs. I do pub fn serve_dir() -> Router { let serve_dir = ServeDir::new("web/dist"); Router::new() .route_service("/", ...
Vana's user avatar
  • 938
0 votes
1 answer
53 views

Using crate tracing_subscriber with info_span! report a panic

i am trying to using tracing & tracing_subscriber with axum it's my code snippet main function: fn main() -> Result<(), io::Error> { let rt = runtime::Builder::new_current_thread() ...
Stop's user avatar
  • 13
0 votes
1 answer
87 views

Enabling tracing::Span per-request in Axum middleware

I have a very simple Axum middleware function where I just enter a span, do some logging and request id attachment. async fn middleware_fn(req: Request, next: Next) -> Response { let start = ...
Ahmet Yazıcı's user avatar
0 votes
0 answers
66 views

JavaScript fetch automatically retries file streaming requests

I am running into a strange issue and I don't quite understand if this is expected or if this is a bug caused by me and if so how to fix it. The problem: When using the fetch function in javascript to ...
pSquared's user avatar
0 votes
1 answer
55 views

Error in signature when trying to pass shared state to my authorization middleware in Axum

I'm trying to pass DB pool which is in State(app_state): State<AppState> to authorize fn inside my auth.rs from api.rs where I'm using this middleware as JWT to protect my urls like this. api.rs ...
Marcel Kopera's user avatar
0 votes
1 answer
50 views

Rust HMAC can't get the right signature

I'm trying to emulate this Svix webhook: https://www.standardwebhooks.com/simulate/svix. I need to generate a signature by combining the svix-id header with the svix-timestamp header and the raw body ...
Kadiem Alqazzaz's user avatar
0 votes
0 answers
101 views

Using or not using Arc for AppState in Axum

I'm not sure whether to wrap AppState with Arc or not. All AI agents answer it is not necessary because AppState is internally wrapped with Arc but it is not explicitly mentioned in the official doc, ...
Ουιλιαμ Αρκευα's user avatar
0 votes
1 answer
386 views

Axum the trait Handler<_, _, _> is not implemented for fn item [duplicate]

While implementing a handler function for an Axum endpoint, I ran accross the following error --> qubic-rpc/src/lib.rs:90:38 | 90 | .route("/balances/{id}", get(routes::...
gmelodie's user avatar
  • 462
0 votes
1 answer
52 views

Utoipa complaining about mismatching signature

In my code I use utoipa in combination with axum. For some reason when registering the routes utoipa reports a signature mismatch. The code is: #[utoipa::path( post, path = "/machines/{id}/...
abergmeier's user avatar
  • 14.1k
0 votes
1 answer
97 views

Rust Axum Access state in nested router [closed]

I'm trying to access the state pool passed from the parent router to the child router, here is the main router in main.rs: let app = Router::new() .nest("/products", ...
Kadiem Alqazzaz's user avatar
0 votes
1 answer
78 views

Extension middleware not added to fallbacks?

I have the following simple code: use std::{net::SocketAddr, path::Path}; use axum::{extract::{ConnectInfo, Request, State}, middleware::Next, response::{Html, IntoResponse, Response}, routing::{get, ...
sudoExclamationExclamation's user avatar
0 votes
1 answer
128 views

multiple fallbacks causes them to fail with 500 Internal Error

I am using Rusts's Axum web framework. I need to have multiple fallbacks. First fallback is for delivering static files such as /script.js and /style.css located in my static folder. Second fallback ...
sudoExclamationExclamation's user avatar

15 30 50 per page
1
2 3 4 5
14