修改后端接口

This commit is contained in:
2025-09-25 17:43:54 +08:00
parent 5b6b7e0a96
commit 76b5393182
31 changed files with 2155 additions and 468 deletions

View File

@@ -23,8 +23,17 @@ const accessLogStream = fs.createWriteStream(
);
app.use(morgan('combined', { stream: accessLogStream }));
// 数据库连接(暂时注释掉,使用内存数据)
// const sequelize = require('./config/database');
// 数据库连接
const sequelize = require('./config/database');
// 测试数据库连接
sequelize.authenticate()
.then(() => {
console.log('数据库连接成功');
})
.catch(err => {
console.error('数据库连接失败:', err);
});
// 路由
app.use('/api/auth', require('./routes/auth'));
@@ -58,5 +67,4 @@ app.use((err, req, res, next) => {
const PORT = process.env.PORT || 5352;
app.listen(PORT, () => {
console.log(`政府管理系统后端服务已启动,端口: ${PORT}`);
console.log(`使用内存数据,无需数据库连接`);
});