front
This commit is contained in:
@@ -90,6 +90,27 @@ app.use(express.static(path.join(__dirname, 'public'), {
|
||||
}
|
||||
}));
|
||||
|
||||
// Serve compiled frontend assets at /assets (Vite output)
|
||||
app.use('/assets', express.static(path.join(__dirname, 'public', 'dist', 'assets'), {
|
||||
setHeaders: (res, filePath) => {
|
||||
res.set('Access-Control-Allow-Origin', '*');
|
||||
res.set('Access-Control-Allow-Methods', 'GET, OPTIONS');
|
||||
res.set('Access-Control-Allow-Headers', 'Content-Type, Accept, Origin');
|
||||
res.set('Access-Control-Allow-Credentials', 'true');
|
||||
res.set('Content-Security-Policy',
|
||||
"default-src 'self' data: blob:; script-src 'self' 'unsafe-inline' 'unsafe-eval' blob:; style-src 'self' 'unsafe-inline'; img-src 'self' data: blob:; font-src 'self' data:; connect-src 'self' http: https: ws: wss:; frame-ancestors 'self'; base-uri 'self';"
|
||||
);
|
||||
|
||||
if (filePath.endsWith('.js') || filePath.endsWith('.mjs')) {
|
||||
res.set('Content-Type', 'application/javascript; charset=utf-8');
|
||||
} else if (filePath.endsWith('.css')) {
|
||||
res.set('Content-Type', 'text/css; charset=utf-8');
|
||||
} else if (filePath.endsWith('.svg')) {
|
||||
res.set('Content-Type', 'image/svg+xml');
|
||||
}
|
||||
}
|
||||
}));
|
||||
|
||||
// Serve landing page at /landing route
|
||||
app.get('/landing', (req, res) => {
|
||||
res.sendFile(path.join(__dirname, 'public', 'landing.html'));
|
||||
|
||||
Reference in New Issue
Block a user