games_app/backend/src/apps/api.ts
2026-07-07 15:03:17 +02:00

41 lines
1.2 KiB
TypeScript

/**
* HTTP API process — serves REST, optional WS disabled here by default.
*/
import app from '../app';
import { config } from '../config';
import { bootstrapCore } from '../bootstrap/appBootstrap';
import { initSentry, captureException } from '../observability/sentry';
initSentry('api');
async function main(): Promise<void> {
await bootstrapCore({
startEngines: config.engineEnabled,
startPlatformMonitors: true,
});
app.listen(config.port, () => {
console.log(`[api] listening on port ${config.port}`);
console.log(`[api] engine inline=${config.engineEnabled} redis=${config.redis.enabled}`);
console.log(`TRON node: ${config.blockchain.tron.nodeUrl}`);
console.log(`Withdrawals broadcasting enabled: ${config.withdrawal.allowWithdrawals}`);
});
}
main().catch((e) => {
captureException(e);
console.error(e);
process.exit(1);
});
process.on('unhandledRejection', (reason) => {
captureException(reason);
console.error('[process] Unhandled promise rejection (continuing):', reason);
});
process.on('uncaughtException', (err) => {
captureException(err);
console.error('[process] Uncaught exception (continuing):', err);
});