import path from "node:path";
import { fileURLToPath } from "node:url";
import { createDb, migrate } from "./db.js";
import { createApp } from "./app.js";

const root = path.join(path.dirname(fileURLToPath(import.meta.url)), "..");
const port = Number(process.env.PORT) || 8090;
const db = createDb();
await migrate(db);
createApp({ db, root }).listen(port, () =>
	console.log(`Roast planner listening on ${port}`),
);
