2026-08-20 11:12:32 +07:00
|
|
|
// API entry point (invoked by `bun run src/index.ts` / systemd unit).
|
|
|
|
|
// Delegates to the testable factory in app.ts so the HTTP surface can be unit-
|
|
|
|
|
// tested without a live process. start() fail-fasts on missing WEBHOOK_SECRET.
|
|
|
|
|
import { createApp, start } from "./app";
|
|
|
|
|
export { createApp, start };
|
|
|
|
|
export type { ApiDeps, QueueLike } from "./app";
|
2026-08-19 21:54:54 +07:00
|
|
|
|
2026-08-20 11:12:32 +07:00
|
|
|
// When run directly (bun run src/index.ts), start the server.
|
|
|
|
|
const isMain =
|
|
|
|
|
typeof process.argv[1] === "string" &&
|
|
|
|
|
import.meta.url === `file://${process.argv[1]}`;
|
|
|
|
|
if (isMain) {
|
|
|
|
|
start().catch((err: unknown) => {
|
|
|
|
|
console.error(err);
|
|
|
|
|
process.exit(1);
|
2026-08-20 10:04:16 +07:00
|
|
|
});
|
2026-08-19 21:54:54 +07:00
|
|
|
}
|