fix(server): füge @hono/node-server hinzu und korrigiere Server-Start für Node.js

This commit is contained in:
2025-10-01 22:41:11 +02:00
parent 18b75fdde3
commit 72834a6977
3 changed files with 27 additions and 9 deletions

View File

@@ -62,8 +62,22 @@ const host = process.env.HOST || "0.0.0.0";
console.log(`🚀 Server starting on ${host}:${port}`);
export default {
port,
hostname: host,
fetch: app.fetch,
};
// For Bun/Node.js compatibility
if (typeof Bun !== 'undefined') {
// Bun runtime
Bun.serve({
port,
hostname: host,
fetch: app.fetch,
});
} else {
// Node.js runtime - use Hono's serve function
import { serve } from '@hono/node-server';
serve({
fetch: app.fetch,
port,
hostname: host,
});
}
export default app;