fix: add explicit routes for admin.html and login.html

## Problem
- admin.html was not serving correctly (returned index.html instead)
- Routes for SPA were catching admin.html requests

## Solution
Added explicit routes before wildcard route:
- GET /admin.html → serve admin.html
- GET /login.html → serve login.html
- GET /login → serve login.html
- GET /admin → redirect to admin.html

## Tested
 login.html returns correct page (title: Iniciar Sesión)
 admin.html returns correct page (title: Panel de Administración)
 Login API works correctly
 Session management works
 Redirect after login to /admin.html works

Closes #28
This commit is contained in:
TenerifeProp Dev
2026-04-06 01:07:06 +01:00
parent 0d290f29a1
commit 659b749a61

View File

@@ -1195,7 +1195,10 @@ app.get('/api/admin/stats', requireAdmin, (c) => {
// Serve static files and SPA routes
app.get('/property/*', serveStatic({ path: './public/property.html' }))
app.get('/admin/*', serveStatic({ path: './public/admin.html' }))
app.get('/admin.html', serveStatic({ path: './public/admin.html' }))
app.get('/login.html', serveStatic({ path: './public/login.html' }))
app.get('/login', serveStatic({ path: './public/login.html' }))
app.get('/admin', (c) => c.redirect('/admin.html'))
// Serve index.html for all other routes
app.get('*', serveStatic({ path: './public/index.html' }))