2026-08-29 14:43:44 +02:00
|
|
|
import { buildApp } from './app.js'
|
|
|
|
|
import { openDatabase } from './db.js'
|
2026-08-29 15:05:46 +02:00
|
|
|
import { loadConfig } from './config.js'
|
2026-08-29 14:43:44 +02:00
|
|
|
|
2026-08-29 15:05:46 +02:00
|
|
|
const config = loadConfig()
|
2026-08-29 14:43:44 +02:00
|
|
|
const db = openDatabase(config.dbPath)
|
|
|
|
|
const app = await buildApp({ db, config })
|
|
|
|
|
await app.listen({ port: config.port, host: '0.0.0.0' })
|
2026-08-29 17:59:22 +02:00
|
|
|
|
|
|
|
|
for (const signal of ['SIGINT', 'SIGTERM'] as const) {
|
|
|
|
|
process.on(signal, () => {
|
|
|
|
|
void (async () => {
|
|
|
|
|
await app.close()
|
|
|
|
|
db.close()
|
|
|
|
|
process.exit(0)
|
|
|
|
|
})()
|
|
|
|
|
})
|
|
|
|
|
}
|