fix: 更改数据库包
This commit is contained in:
@@ -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)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user