rust-axum Questions
2
Trying to get the full request URI (scheme + authority + path)
I have found the discussion: https://github.com/tokio-rs/axum/discussions/1149 which says that Request.uri() should have it.
So I trie...
2
Solved
I want to route both http://0.0.0.0/foo and http://0.0.0.0/foo/ to the same get_foo handler. However, in practice, only /foo gets routed and /foo/ 404s. I suspect I'm setting up/attaching the middl...
2
Solved
Before a fetch is sent, the browser will send a request method OPTIONS to confirm that the API will accept the request from a script with a particular origin.
Chrome shows that the my Axum server i...
Garbo asked 26/8, 2022 at 8:59
0
Here's my minimum reproducible example:
use axum::{extract::State, Json, Router};
use diesel::pg::Pg;
use diesel_async::{
pooled_connection::bb8::Pool,
AsyncConnection, AsyncPgConnection, RunQuer...
Meras asked 8/6, 2023 at 18:0
0
Problem with reqwest as client and axum as server (axum blows up at 1k req/s with port in use error)
I have problem, why do I get this error when sending request
Error: reqwest::Error {
kind: Request,
url: Url {
scheme: "http",
cannot_be_a_base: false,
username: "",
...
1
Ok so I have an axum handler which looks somewhat like this:
#[debug_handler]
async fn handler(
State(server_state): State<Arc<Server>>,
Query(query_params): Query<Query>,
) -&g...
1
I am building an handler that requires state to be injected and also needs to extract the query parameters.
I started off by only extracting the state and that worked. The code for that looks somet...
1
Solved
I'm learning Axum and I will like to add logging to the service I have put together but unfortunately I cannot get it to work.
I have added tower-http to use the TraceLayer and added it to my app:
...
Martins asked 4/1, 2023 at 17:44
1
Solved
I am using Axum for a relatively simple Web API and would like to get a logging/tracing output for incoming requests similar to Go Gin, IIS logs, Python FastAPI, etc. - a simple path and parameters...
Debility asked 3/11, 2022 at 11:9
1
Solved
For example, when user access http://127.0.0.1:8080/hello, if query parameter id is 1, a plain text response return. If id is 2, give a JSON structure.
Summary:
id (input)
status code
content-ty...
1
Solved
I'm trying to add a request id to each tracing event. I can do it with tower_http::trace like this:
#[derive(Clone)]
pub struct RequestSpan;
impl<B> tower_http::trace::MakeSpan<B> for ...
Vannavannatta asked 25/9, 2021 at 18:17
1
Solved
I want to instantiate a struct instance and then call a method of that instance in an api route. Here's an example of what I want, but it results in an error:
use axum::{http::StatusCode, routing::...
1
Solved
I know that Axum is built on top of Tokio and Tokio has a multi-threaded scheduler and current-threaded scheduler.
Is it possible to set the runtime to make it serve the requests in single thread?
...
Kierstenkieselguhr asked 15/7, 2022 at 3:38
1
Solved
When I tried to build an application with axum, I failed to separate the framework from my handler. With Go, the classic way is define an Interface, implement it and register the handler to framewo...
1
© 2022 - 2025 — McMap. All rights reserved.