Corrigindo ordem das rotas da API para evitar interceptação do app.get('*')

This commit is contained in:
2026-06-07 23:05:55 +00:00
parent 02d0c6fb86
commit 805254f838
2 changed files with 11 additions and 4 deletions
+5 -4
View File
@@ -4566,10 +4566,6 @@ app.post('/api/chat', requireAuth, async (req, res) => {
}
});
// Rota coringa para redirecionar para index.html
app.get('*', requireAuth, (req, res) => {
res.sendFile(path.join(__dirname, 'public', 'index.html'));
});
// ============================================================
@@ -4689,6 +4685,11 @@ app.delete('/api/alunos/:id', requireAuth, async (req, res) => {
}
});
// Rota coringa para redirecionar para index.html
app.get('*', requireAuth, (req, res) => {
res.sendFile(path.join(__dirname, 'public', 'index.html'));
});
app.listen(PORT, '0.0.0.0', () => {
console.log(`Servidor rodando na porta ${PORT}`);
initDatabase();