Redirecting /api to homepage
Hey! I'm using TS Router (via Start) and am trying to redirect
/api
to the homepage. I made a routes/api/index.ts
that redirects to /
, but it doesn't seem to ever get hit. How can I fix this?11 Replies
fascinating-indigo•5mo ago
how do you redirect?
extended-salmonOP•5mo ago
fascinating-indigo•5mo ago
not a bug really
just not supported right now
however, your way should work
can you provide a complete minimal example repo?
extended-salmonOP•5mo ago
Here's my full redirect code:
Give me a few minutes whilst I make the example repo
extended-salmonOP•5mo ago
GitHub
GitHub - SkyfallWasTaken/tanstack-start-redirect-api-route
Contribute to SkyfallWasTaken/tanstack-start-redirect-api-route development by creating an account on GitHub.
fascinating-indigo•5mo ago
hm seems like a bug in the api routes matching
since we are currently reworking API routes and they wont be bound to the /api prefix any more, this will be resolved once we have released that
extended-salmonOP•5mo ago
got it! should I file an issue?
fascinating-indigo•5mo ago
it shouldnt be necessary
extended-salmonOP•5mo ago
👍
in the meantime, is it possible to mount hono or some other API framework by any chance?
fascinating-indigo•5mo ago
extended-salmonOP•5mo ago
nice! thank you :)
For future searchers, if you set
src/api.ts
to:
You can then use the api
directory for your routes instead of server/api
or some other directory!