#SvelteKit dynamic api routes with Tauri?

13 messages · Page 1 of 1 (latest)

lofty glade
#

Hello, I have an /api/stream api route which uses query params to stream the required audio to the frontend (/api/stream?id=blahblah. It works great in dev mode, but when I build the app, it gives the error @sveltejs/adapter-static: all routes must be fully prerenderable, but found the following routes that are dynamic:- src\routes/api/stream. Is such a thing not possible with Tauri?

quiet pond
#

There's no nodejs runtime in a tauri app and therefore no sveltekit server == no serverside features

lofty glade
drowsy idol
#

Depends on what the api does but either serve it separately or you could indeed use a nodejs sidecar

#

But you lose all the principe of Tauri lol

lofty glade
# drowsy idol But you lose all the principe of Tauri lol

So is there any way to create a REST api in the rust backend? I am not familiar with the rust ecosystem, what crate can I use? There is the http tauri api and the warp crate. Can any of them substitute SvelteKit server routes or express? I don't thing i can use the commands system, since html audio tag needs a url to stream audio.

versed idol
lofty glade
versed idol
#

well if you are willing to use rust and run a backend HTTP server (which I have done before as well for oauth), you could use something like axum

lofty glade
quiet pond