feat: serve frontend from backend for production deploy
This commit is contained in:
@@ -71,4 +71,15 @@ app.get('/health', (req, res) => {
|
||||
res.json({ status: 'ok', timestamp: new Date() });
|
||||
});
|
||||
|
||||
// Serve frontend static files
|
||||
const clientPath = path.join(process.cwd(), 'dist', 'client');
|
||||
if (fs.existsSync(clientPath)) {
|
||||
app.use(express.static(clientPath));
|
||||
app.get('*', (req, res) => {
|
||||
if (!req.path.startsWith('/api') && !req.path.startsWith('/uploads')) {
|
||||
res.sendFile(path.join(clientPath, 'index.html'));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
export default app;
|
||||
|
||||
Reference in New Issue
Block a user