Questions tagged [rust-axum]

80 questions
0
votes
0 answers

How do I catch the rust Axum Request and then convert the Request to my own type?

I am new to Rust as Backend developer. So I dont know which web library today is the best. So I choose not to worry about that but make a wrapper for the web library. To do so, First thing I need to do is, not let the library to ruin all of my code…
Ma Zheng
  • 11
  • 2
0
votes
0 answers

Rust and jsonwebtoken: unable to validate a RSA signed jwt token

Acutally playing with rust and jwt, I am developing a dummy app that basically does two things: return a jwt token when user does login (it relies on github as idp), ... let claim = Claims { user_email: String::from(user_email.as_str()), …
Francesco
  • 1,742
  • 5
  • 44
  • 78
0
votes
0 answers

Axum: Send image as response

I'm currently trying to build an endpoint that will return an image (not in in bytes nor b64) to the user based on path but I cannot figure out how to do that with Axum and Rust. The template of the method should look like that I…
MidKnight
  • 75
  • 7
0
votes
0 answers

Support for graphql server configuration and subscription using AXUM

I have configured graphql server and graphql playground support using AXUM. However, I want to support subscription. When I implement that api and call it from graphql playground, it doesn't work properly. I implemented the functionality for…
hbkim
  • 11
  • 1
0
votes
0 answers

Failing to open websocket client connection on both wasm and native builds

I am building out my first Rust client/server application and struggling to get my client/server talking to each other over a websocket connection. Any help would be highly appreciated! Problem Overview I am using axum with axum-login on the…
Bryan Reilly
  • 114
  • 4
0
votes
1 answer

How do I create and pass a prisma connection into my route in rust?

I am creating a rust backend using prisma and axum. I am trying to figure out the best way(or any working way) to pass my connection into my rust routes. I have created a new client in main which I am passing to the routes mod and then passing to…
Avi4nFLu
  • 152
  • 8
0
votes
0 answers

How to read sec-websocket-protocol header with Axum

I'm using Axum with Rust. In the web socket handler function I want to read custom sec-websocket-protocol. On the extract side I couldn't see anything regarding sub-protocol. Is there any way to access it? async fn ws_handler( ws:…
ermeo
  • 1
0
votes
1 answer

Is Axum, with Tokio disabled, still asynchronous?

I'm still very new to Rust and therefore still trying to make sense of a lot of things. I noticed Axum can now have the Tokio feature disabled, in order to compile it to WebAssembly, and deploy it to something like CloudFlare Workers. But how does…
0
votes
1 answer

'Bson: Borrow is not satisifed' error in simple CRUD post function

I have following Error: error[E0277]: the trait bound `Bson: Borrow` is not satisfied --> src\handlers.rs:46:36 …
0
votes
1 answer

How to use enums as a query parameter with Axum

I have an enum similar to: #[derive(Debug, Deserialize, Serialize)] pub enum Gender { Male, Female, NonBinary } and I a have an axum handler function which expects it to be passed in as Query(gender): Query But when I request…
Finlay Weber
  • 2,989
  • 3
  • 17
  • 37
0
votes
0 answers

Rust Async Graphql Json InputObject Type

I'm trying to use Async Graphql, I want to use sqlx json type in model. In normal api operations the code is running. But when I want to use the async graphql InputObject macro, I get an error. The codes I used are as follows, I couldn't find a…
0
votes
0 answers

Using axum and reqwest to upload a file to cloud bucket, streaming it

I've created a small Github repo that mimics exactly what I'm trying to achieve: streaming file uploads to both file systems and the cloud (S3) using axum (and reqwest). I can change all the code you see. There is no restriction. All signatures were…
Fred Hors
  • 3,258
  • 3
  • 25
  • 71
0
votes
0 answers

Drop a connection without sending any response in axum

Is it possible to not send any response to an incoming request using axum? I am trying to implement a blacklist, and while it's certainly possible to just return a 404 (you might make an argument for a different error code), if an address has earned…
d2718
  • 175
  • 8
0
votes
0 answers

How to save the Future object generated by hyper::Server::with_graceful_shutdown()?

When I was using the hyper server, I wanted to be able to shut it down gracefully. So I was using with_graceful_shutdown() to get a Future. The following code works fine. let signer = Arc::new(Notify::new()); let waiter = signer.clone(); …
progquester
  • 1,228
  • 14
  • 23
0
votes
1 answer

Why does my program get stuck at epoll_wait?

I have some structs that are used to de-serialize requests from GCP alerting. The top-level structs implement FromResponse, and the nested structs all implement serde's Deserialize and Serialize traits. Here are the structs (omitted ones that are…