feat(server): 添加数据库连接测试并优化启动脚本
添加了服务器启动时的数据库连接测试功能,确保数据库可用性 新增 start.bat 和 dev.bat 脚本用于简化开发和生产环境启动 脚本会自动检查端口占用并处理依赖安装
This commit is contained in:
@@ -122,7 +122,11 @@ app.use((err, req, res, next) => {
|
||||
res.status(500).json({ error: 'Internal server error' });
|
||||
});
|
||||
|
||||
app.listen(PORT, () => {
|
||||
app.listen(PORT, async () => {
|
||||
console.log(`Server running on port ${PORT}`);
|
||||
console.log(`访问地址: http://localhost:${PORT}`);
|
||||
|
||||
// 测试数据库连接
|
||||
const dbConfig = require('./config/database');
|
||||
await dbConfig.testConnection();
|
||||
});
|
||||
Reference in New Issue
Block a user