import { buildApp } from './app.js';
import { config } from './config/index.js';

const app = buildApp();

const start = async () => {
  try {
    await app.listen({ port: config.port, host: config.host });
    console.log(`Server läuft auf http://${config.host}:${config.port}`);
    console.log(`Health Check: http://${config.host}:${config.port}/health`);
    console.log(`QR-Bill API: POST http://${config.host}:${config.port}/api/v1/invoice/qr-bill`);
  } catch (err) {
    app.log.error(err);
    process.exit(1);
  }
};

start();
