Files
dashback/src/index.js
2026-07-31 05:54:13 +02:00

26 lines
595 B
JavaScript

import './config/env.js';
import { startApi, stopApi } from './api/index.js';
import { closeStore } from './db/store.js';
async function shutdown() {
await stopApi();
try {
await closeStore();
} catch (error) {
console.error('Failed to close database:', error);
process.exitCode = 1;
}
}
process.on('SIGINT', () => {
shutdown().then(() => process.exit(0));
});
process.on('SIGTERM', () => {
shutdown().then(() => process.exit(0));
});
startApi().catch((err) => {
console.error('Failed to start API:', err.message);
process.exit(1);
});