Error trying to serve TRPC from custom path in Hono
I'm successfully serving a basic "hello world" using the default root path:
I can see the Hello World greeting I defined when I run
curl http://localhost:3000/trpc/getGreeting
However, if I make a trivial change to the URL, like serving it from "/trpc2/*", trpc fails with a not-found error with a weird mangled path:
(notice the first four characters missing on the path in the error message)
I'm using Hono and the new tanstack-query-trpc integration.
Am I missing something? Why is the path mangled in the error message?2 Replies
Not at my PC right now, but try to add an endpoint to trpcServer
app.use(
"/api/*",
trpcServer({ endpoint: "/api", router: appRouter, createContext })
)
thank you, sorry, that's obvious to me now looking at the docs. I was looking for a config like that but somehow missed it. That's what happens when I do this late at night