import { createServer } from "node:http";
import app from "./app";
import { ensureSchema } from "./shared/db/pool";
import { env } from "./config/env";
import { logger } from "./shared/services/logger";

const port = env.PORT;

const server = createServer(app);

async function bootstrap() {
  await ensureSchema();

  server.listen(port, () => {
    logger.info("server_started", {
      port
    });
  });
}

void bootstrap();
