T
TanStack10mo ago
flat-fuchsia

Are there plans to have an RPC-like thing for api routes?

I was just curious if there are any plans to formalize api routes having an RPC client. RPC). For example it would be super cool if you could createServerSideFn({apiRoute: "users?id", method: "GET" }) or something like that
6 Replies
extended-salmon
extended-salmon10mo ago
plans? no hopes? yes unless I misunderstood the question is this about being able to specify a path for a server function?
flat-fuchsia
flat-fuchsiaOP10mo ago
Basically. It seems to me like createServerSideFn get's all the cool RPC like goodies but api routes are just "Make a fetch call to this", I'm guessing that partially stems from the fact that api routes don't contribute to the generated route tree file, and the api routes aren't built for validation / middleware etc....
extended-salmon
extended-salmon10mo ago
you mean createServerFn right?
flat-fuchsia
flat-fuchsiaOP10mo ago
yeah sorry about that
extended-salmon
extended-salmon10mo ago
well yes then I understood what you mean correctly already . as i wrote above, we hope to replace API routes by server functions some day. but not a priority right now and totally not thought through
flat-fuchsia
flat-fuchsiaOP10mo ago
@Manuel Schiller Gracias! Just was curious is all, still am extremely excited for everything going on! For what it's worth I think it's effectively a non-issue if you just use something like Hono's RPC client in tandem with Tanstack Start

Did you find this page helpful?