Skip to content

API Routes support for express handlers #2241

@jadedevin13

Description

@jadedevin13

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

import { tusServer } from '@/server/tus-server'
import { eventHandler } from 'vinxi/http'


export default eventHandler(async (event) => {
    return tusServer.handle(event.node.req, event.node.res)
})

This is done by using the following in the app.config.ts

import { apiRouter } from '@vinxi/router/api'

This is cool because I can add middlewares for auth like.

    apiRouter({ dir: './api-ext', base: '/_api', middleware: './app/middleware/api-middleware.ts' }),

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions