fix: 更改数据库包

This commit is contained in:
Daniel
2026-03-03 14:49:02 +08:00
parent 85dea726e9
commit 29c921f498
10 changed files with 338 additions and 461 deletions

View File

@@ -4,6 +4,7 @@ const fs = require('fs')
const express = require('express')
const cors = require('cors')
const { WebSocketServer } = require('ws')
const db = require('./db')
const routes = require('./routes')
const { getSituation } = require('./situationData')
@@ -67,7 +68,12 @@ function notifyCrawlerUpdate() {
} catch (_) {}
}
server.listen(PORT, () => {
console.log(`API + WebSocket running at http://localhost:${PORT}`)
console.log(`Swagger docs at http://localhost:${PORT}/api-docs`)
db.initDb().then(() => {
server.listen(PORT, () => {
console.log(`API + WebSocket running at http://localhost:${PORT}`)
console.log(`Swagger docs at http://localhost:${PORT}/api-docs`)
})
}).catch((err) => {
console.error('DB init failed:', err)
process.exit(1)
})