router
router copied to clipboard
server routes with a `.ts` extension gets the wrong boilerplate while creating the file.
Which project does this relate to?
Router
Describe the bug
Using the start-basic example, I tried to create a new .ts file under /routes/api. howerver, i get the wrong boilerplate filled in.
import { createFileRoute } from '@tanstack/react-router'
export const Route = createFileRoute('/api/users')({
component: RouteComponent,
})
function RouteComponent() {
return <div>Hello "/api/users"!</div>
}
instead of something like this.
export const ServerRoute = createServerFileRoute().methods({
GET: async ({ request }) => {
return new Response('Hello, World!')
},
})
Your Example Website or App
https://stackblitz.com/edit/github-orkptmtq?file=src%2Froutes%2Fapi%2Fuser.ts
Steps to Reproduce the Bug or Issue
Try to create any server routes in the stackblitz example ( assuming they are created with a .ts extention )
Expected behavior
I wanted the right boilerplate to be filled in.
Screenshots or Videos
No response
Platform
- OS: Fedora 42
- Version:
"@tanstack/react-router": "^1.121.24",
"@tanstack/react-router-devtools": "^1.121.24",
"@tanstack/router-plugin": "^1.121.25",
Additional context
No response
that's not a bug really, rather a feature request. I get it though and we should make the scaffolding logic customizable so you can implement this yourself.