Skip to content
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

h3 support? #79

Open
lautiamkok opened this issue Mar 5, 2023 · 1 comment
Open

h3 support? #79

lautiamkok opened this issue Mar 5, 2023 · 1 comment

Comments

@lautiamkok
Copy link

lautiamkok commented Mar 5, 2023

Is it possible to support [unjs/h3](https://github.com/unjs/h3)? I tried the following code with the custom setup:

// ./app.ts
import { createServer } from 'node:http'
import { createApp, eventHandler, toNodeListener } from 'h3'

const app = createApp()
app.use(
  '/',
  eventHandler(() => 'Hello world!')
)

const listener = createServer(toNodeListener(app))

if (import.meta.env.PROD) {
  listener.listen(process.env.PORT || 3000)
  console.log(`🚀 Server ready at *:3000`)
}

export const viteNodeApp = listener

Error:

file:///...e/vite.config.ts.timestamp-1678018252429.mjs:16
        app(res, res);
        ^

TypeError: app is not a function

Any ideas?

@axe-me
Copy link
Owner

axe-me commented Nov 9, 2023

not very familiar with h3, but try expose the app instead the listener.
export const viteNodeApp = app

@lautiamkok lautiamkok changed the title t3 support? h3 support? Dec 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants