Upload app.js
Browse files- backend/src/app.js +22 -1
backend/src/app.js
CHANGED
|
@@ -74,10 +74,31 @@ app.get('/api/github/status', async (req, res) => {
|
|
| 74 |
}
|
| 75 |
});
|
| 76 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 77 |
app.use('/api/auth', authRoutes);
|
| 78 |
-
|
|
|
|
| 79 |
app.use('/api/public', publicRoutes);
|
| 80 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 81 |
// 添加调试中间件 - 处理未匹配的API路由
|
| 82 |
app.use('/api/*', (req, res) => {
|
| 83 |
console.log(`Unmatched API route: ${req.method} ${req.path}`);
|
|
|
|
| 74 |
}
|
| 75 |
});
|
| 76 |
|
| 77 |
+
// 添加路由注册日志
|
| 78 |
+
console.log('Importing route modules...');
|
| 79 |
+
console.log('Auth routes imported:', !!authRoutes);
|
| 80 |
+
console.log('PPT routes imported:', !!pptRoutes);
|
| 81 |
+
console.log('Public routes imported:', !!publicRoutes);
|
| 82 |
+
|
| 83 |
+
// 认证相关路由(不需要认证)
|
| 84 |
app.use('/api/auth', authRoutes);
|
| 85 |
+
|
| 86 |
+
// 公共访问路由(不需要认证)
|
| 87 |
app.use('/api/public', publicRoutes);
|
| 88 |
|
| 89 |
+
// 添加测试路由来验证 PPT 路由是否工作(不需要认证)
|
| 90 |
+
app.get('/api/ppt/test', (req, res) => {
|
| 91 |
+
res.json({ message: 'PPT routes are working', timestamp: new Date().toISOString() });
|
| 92 |
+
});
|
| 93 |
+
|
| 94 |
+
// PPT管理路由(需要认证)
|
| 95 |
+
app.use('/api/ppt', (req, res, next) => {
|
| 96 |
+
console.log(`PPT route accessed: ${req.method} ${req.path}`);
|
| 97 |
+
next();
|
| 98 |
+
}, authenticateToken, pptRoutes);
|
| 99 |
+
|
| 100 |
+
console.log('All routes registered successfully');
|
| 101 |
+
|
| 102 |
// 添加调试中间件 - 处理未匹配的API路由
|
| 103 |
app.use('/api/*', (req, res) => {
|
| 104 |
console.log(`Unmatched API route: ${req.method} ${req.path}`);
|