mirror of
https://github.com/linux-odyssey/linux-odyssey.git
synced 2026-11-06 03:20:13 +08:00
fix: error handling
- Remove unnecessary try-catch block in createSession function - Add error handling for missing session ID in socket.js - Improve error handling in connectDB function - Add error handling middleware for server errors - Add default export for get function in env.js Signed-off-by: wancat <wancat@wancat.cc>
This commit is contained in:
1 parent
943c11714c
commit
88ed447573
6 files changed
+36
-14
No files matched your search
@@ -9,6 +9,7 @@ import connectDB from './db.js'
|
||||
import apiRouter from './api/routes/index.js'
|
||||
import loadAndUpdateQuests from './utils/quest.js'
|
||||
import config from './config.js'
|
||||
import errorHandler from './middleware/error.js'
|
||||
|
||||
async function main() {
|
||||
const app = express()
|
||||
@@ -28,6 +29,8 @@ async function main() {
|
||||
|
||||
app.use('/api/v1', apiRouter)
|
||||
|
||||
app.use(errorHandler)
|
||||
|
||||
server.listen(config.port, config.host, () => {
|
||||
console.log(`Server listening at http://${config.host}:${config.port}`)
|
||||
})
|
||||
|
||||
Reference in new issue
Block a user