fix: serve admin component files with explicit routes
The previous route '/admin' with serveStatic was catching all /admin/* requests before component files could be served. Added explicit routes for each admin component file (sidebar.html, topbar.html, etc.) to ensure they are served correctly before the /admin SPA route.
This commit is contained in:
@@ -1193,8 +1193,16 @@ app.get('/api/admin/stats', requireAdmin, (c) => {
|
||||
})
|
||||
|
||||
// Serve static files and SPA routes (clean URLs without .html)
|
||||
// Admin components - serve as static files before admin route
|
||||
app.use('/admin', serveStatic({ path: './public/admin' }))
|
||||
// Admin component files - serve explicitly BEFORE the /admin route
|
||||
app.get('/admin/sidebar.html', serveStatic({ path: './public/admin/sidebar.html' }))
|
||||
app.get('/admin/topbar.html', serveStatic({ path: './public/admin/topbar.html' }))
|
||||
app.get('/admin/dashboard.html', serveStatic({ path: './public/admin/dashboard.html' }))
|
||||
app.get('/admin/properties.html', serveStatic({ path: './public/admin/properties.html' }))
|
||||
app.get('/admin/leads.html', serveStatic({ path: './public/admin/leads.html' }))
|
||||
app.get('/admin/testimonials.html', serveStatic({ path: './public/admin/testimonials.html' }))
|
||||
app.get('/admin/faq.html', serveStatic({ path: './public/admin/faq.html' }))
|
||||
app.get('/admin/services.html', serveStatic({ path: './public/admin/services.html' }))
|
||||
app.get('/admin/settings.html', serveStatic({ path: './public/admin/settings.html' }))
|
||||
|
||||
// SPA routes
|
||||
app.get('/property/*', serveStatic({ path: './public/property.html' }))
|
||||
|
||||
Reference in New Issue
Block a user