Get API URL(link) from server function & API route
Hi team thanks for the awesome stack.
I wonder if there is a typesafe way to get the URL of an api route, e.g.
https://mydomain.com/api/thatCallback
, from within a server function or API route?
If not, just getting a relative path is also good.
This will be useful for both API route and server function.
Cheers.1 Reply
adverse-sapphireOP•4mo ago
Problem solved.
For your reference:
Also, i might have found a bug that if I try the same for non-api routes, I always get Route.to as undefined from Server function.
There is way to walk around for me at the moment with
redirect({to:})
from '@tanstack/react-router'