fix(server): füge @hono/node-server hinzu und korrigiere Server-Start für Node.js
This commit is contained in:
@@ -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;
|
||||
|
Reference in New Issue
Block a user