DEV Community

Discussion on: Create a desktop app in Rust using Tauri and Yew

Collapse
 
itflyingstart profile image
ItFlyingStart

Great tutorial. Thanks.

Dummy question: if I want to consume an external web service. Should I implement it in the frontend (Yew) or in the backend (Tauri)?

Collapse
 
stevepryde profile image
Steve Pryde

Apologies for the late reply but this is not a dummy question at all. I'll try to offer some info that might help you decide.

Firstly, it should be possible to do it in either. Browsers have the Fetch API available to them and you can use this within wasm: rustwasm.github.io/wasm-bindgen/ex...
From the backend you can use any HTTP client in Rust, for example reqwest.

If you do the web requests from wasm then any credentials etc will be visible via the built-in browser devtools (network tab) and depending on how much JS you have in your app it could also be vulnerable to XSS attacks.

Doing the requests from the backend in tauri should make this less visible and away from any XSS attacks. The backend would be my preference.