main.ts

460 B · raw

1import { createApp } from "./server/app.ts";2import { ConfigError, loadConfig } from "./server/config.ts";34try {5	const config = await loadConfig("kepr.toml");6	// Bun.serve reads the port from $PORT (default 3000).7	const server = Bun.serve({ fetch: createApp(config).fetch });8	console.log(`kepr listening on ${server.url}`);9} catch (error) {10	if (!(error instanceof ConfigError)) throw error;11	console.error(`kepr: ${error.message}`);12	process.exit(1);13}