hellth-hub/packages/api/src/index.ts

21 lines
549 B
TypeScript
Raw Normal View History

import { config } from "dotenv";
config({ path: "../../.env" });
try {
const { db, runMigrations } = await import("@hellth/db");
await runMigrations(db);
const { serve } = await import("@hono/node-server");
const { app } = await import("./app");
const port = Number(process.env.API_PORT) || 3002;
serve({ fetch: app.fetch, port, hostname: "0.0.0.0" }, (info) => {
console.log(`API läuft auf http://localhost:${info.port}`);
});
} catch (err) {
console.error("API konnte nicht gestartet werden:", err);
process.exit(1);
}