fix: remove nginx, serve frontend from Express on port 3000, fix static path
This commit is contained in:
@@ -22,7 +22,7 @@ import settingsRouter from './routes/settings';
|
||||
import notificationsRouter from './routes/notifications';
|
||||
|
||||
const app = express();
|
||||
const PORT = process.env.PORT || 5000;
|
||||
const PORT = parseInt(process.env.PORT || '3000', 10);
|
||||
|
||||
// Security
|
||||
app.use(helmet({ contentSecurityPolicy: false }));
|
||||
@@ -71,7 +71,8 @@ app.use('/api/v1/settings', settingsRouter);
|
||||
app.use('/api/v1/notifications', notificationsRouter);
|
||||
|
||||
// Serve frontend in production
|
||||
const frontendDist = path.join(__dirname, '../../public');
|
||||
// __dirname = /app/dist, frontend is at /app/public
|
||||
const frontendDist = path.join(__dirname, '../public');
|
||||
app.use(express.static(frontendDist));
|
||||
app.get('*', (req, res) => {
|
||||
res.sendFile(path.join(frontendDist, 'index.html'));
|
||||
|
||||
Reference in New Issue
Block a user