-
-
Notifications
You must be signed in to change notification settings - Fork 705
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
API Routes support for express handlers #2241
Comments
Note that i've tried doing this but it's not working in prod build, only in dev. Specifically the PATCH method. I'm not sure why. import { tusServer } from '@/server-only/tus-server'
import { json } from '@tanstack/start'
import { createAPIFileRoute } from '@tanstack/start/api'
import { getEvent } from 'vinxi/http'
export const Route = createAPIFileRoute('/api/tus/$file')({
GET: ({ request, params }) => {
const event = getEvent()
return tusServer.handle(event.node.req, event.node.res)
},
POST: ({ request, params }) => {
const event = getEvent()
return tusServer.handle(event.node.req, event.node.res)
},
PATCH: ({ request, params }) => {
const event = getEvent()
return tusServer.handle(event.node.req, event.node.res)
},
PUT: ({ request, params }) => {
const event = getEvent()
return tusServer.handle(event.node.req, event.node.res)
},
OPTIONS: ({ request, params }) => {
const event = getEvent()
return tusServer.handle(event.node.req, event.node.res)
},
}) |
@jadedevin13 please make sure you provide a reproduction/a minimal example when filing an issue. If you are using Router, you can create a reproduction using this Stackblitz starter: https://stackblitz.com/github/tanstack/router/tree/main/examples/react/quickstart-file-based?preset=node&file=src/main.tsx |
Closing this as there's no reproduction available. |
Describe the bug
Raising this as an issue because it's working before and now it's working only in dev.
I used to be able to do something like this before the tanstack start api routes were introduced
This is done by using the following in the app.config.ts
This is cool because I can add middlewares for auth like.
But unfortunately, when building for prod. It removed those files and instead just use the tanstack api. So I either need to use tanstack start api or use the vinxi api route which is currently have so much more features than start api provides.
Your Example Website or App
NA
Steps to Reproduce the Bug or Issue
NA
Expected behavior
NA
Screenshots or Videos
No response
Platform
NA
Additional context
No response
The text was updated successfully, but these errors were encountered: