Which project does this relate to?
Start
Describe the bug
In the alpha branch"1.121.0-alpha.20" I am trying to reference the ServerRoute I've created as shown in the docs. I think this should be possible.
import { createServerFileRoute } from "@tanstack/react-start/server"
import { useState } from "react"
export const ServerRoute = createServerFileRoute().methods({
POST: async ({ request }) => {
const body = await request.json()
return new Response(JSON.stringify({ message: `Hello, ${body.name}!` }))
},
})
export const Route = createFileRoute({
component: HelloComponent,
})
function HelloComponent() {
const [reply, setReply] = useState('')
return (
<div>
<button
onClick={() => {
ServerRoute.methods
.post({
body: JSON.stringify({ name: 'John' }),
})
.then((res) => res.json())
.then((data) => setReply(data.message))
}}
>
Say Hello
</button>
</div>
)
}
I am also getting some TypeScript errors
Your Example Website or App
brenelz/tanstack-faster-react#2
Steps to Reproduce the Bug or Issue
- pnpm dev
- http://localhost:3000/test
- See error "The requested module '/src/routes/test.tsx' does not provide an export named 'ServerRoute'"
Expected behavior
I expect to be able to click the button which will make a POST request to my server route and return
Screenshots or Videos
No response
Platform
- OS: macOS
- Browser: Chrome
- Version: 136.0.7103.114
Additional context
No response
Which project does this relate to?
Start
Describe the bug
In the alpha branch"1.121.0-alpha.20" I am trying to reference the
ServerRouteI've created as shown in the docs. I think this should be possible.I am also getting some TypeScript errors
Your Example Website or App
brenelz/tanstack-faster-react#2
Steps to Reproduce the Bug or Issue
Expected behavior
I expect to be able to click the button which will make a POST request to my server route and return
Screenshots or Videos
No response
Platform
Additional context
No response