Is there a useFetch alternative that allows me to call the server function without a string?

I might call a server endpoint like so:
const { data: userData } = await useFetch<User>('/api/test')
const { data: userData } = await useFetch<User>('/api/test')
I'd like to do something more trpc-like, allowing me to avoid the use of strings. Is this currently possible?
2 Replies
manniL
manniL12mo ago
GitHub
GitHub - antfu/nuxt-server-fn: Server functions in client for Nuxt 3
Server functions in client for Nuxt 3. Contribute to antfu/nuxt-server-fn development by creating an account on GitHub.
Cody Bontecou
Cody BontecouOP12mo ago
Oh, nice. At first glance that seems to do the trick.

Did you find this page helpful?