Error using Tauri and Axum in the main function

I need to run an HTTP server (being built with Axum) alongside Tauri in the main function. I noticed the server doesn't allow client connection when I initialize Tauri

I tried running the server in a separate thread, it's still the same thing .

I also tried putting the Tauri initialization code in a function and call it from the main function, doesn't work either

What could possibly be doing wrong
Here is the source

It's pretty unusual to want to run two separate web server frameworks in the same process. I'd certainly expect conflicts – the soundest advice is probably just "don't do this".

A concrete reason for conflicts might be that the two are fighting for a port. Are you sure they are not trying to listen on the same port? Are you sure you are trying to connect to the port that the server (well, whichever one it is you are trying to reach) is listening on?

Anyway, there are more (albeit unrelated) red flags in your code (e.g., in the handler() function, why are you calling format!() if there's nothing to format?), so perhaps a general cleanup/refactor should reveal more potential problems?


I'd refactor that.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.