T
TanStack9mo ago
sunny-green

File API Routes Not Working?

Followed the instructions in the docs to setup a demo project. Added files for API routes and the code autogenerated as expected! However, I keep getting Not Found when I hit the routes in the browser. Am I missing a step?
10 Replies
vicious-gold
vicious-gold9mo ago
can you please provide a minimal example? e.g. via a github repo
wise-white
wise-white9mo ago
have you restarted the dev server ? i had to delete my generated file and restart the dev server for it to work the first time
sunny-green
sunny-greenOP9mo ago
GitHub
GitHub - MassHesteria/tanstack-start-demo: Trying out Tanstack Star...
Trying out Tanstack Start Beta release. Contribute to MassHesteria/tanstack-start-demo development by creating an account on GitHub.
sunny-green
sunny-greenOP9mo ago
Definitely have restarted the server, maybe I broke something adding Tailwind. I could try starting over if that's the best approach I just added a api.stuff.ts file in /routes/ thinking I'd get a /api/stuff route
foreign-sapphire
foreign-sapphire9mo ago
API Routes | TanStack Router React Docs
API Routes are a powerful feature of TanStack Start that allow you to create server-side endpoints in your application without the need for a separate server. API Routes are useful for handling form s...
sunny-green
sunny-greenOP9mo ago
Yep, that seems to be the difference maker! Thanks!
noble-gold
noble-gold9mo ago
Hey I have bootstrapped a new project with the CLI, and i do not have the app folder, do I need to create the api entry point?
foreign-sapphire
foreign-sapphire9mo ago
If you plan on using API routes, probably yes
noble-gold
noble-gold9mo ago
I do not have the app folder where should I create it
foreign-sapphire
foreign-sapphire9mo ago
I am unsure if the CLI is final yet, so I'd follow this: https://tanstack.com/router/latest/docs/framework/react/start/build-from-scratch
Build a Project from Scratch | TanStack Router React Docs
[!NOTE] If you chose to quick start with an example or cloned project, you can skip this guide and move on to the guide. So you want to build a TanStack Start project from scratch? This guide will hel...

Did you find this page helpful?