PozoAppCommonUpdatedCode/server/server.js.working_backup_v-...

24 lines
698 B
Plaintext
Raw Permalink Normal View History

2025-12-05 09:45:16 +05:30
import express from 'express';
import path from 'path';
import { fileURLToPath } from 'url';
import seoMiddleware from './seo-middleware.js';
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const app = express();
const PORT = process.env.PORT || 3000;
// CRITICAL: Apply SEO middleware FIRST (before static files)
// This ensures HTML requests go through SEO middleware
app.use(seoMiddleware);
// Serve static files (CSS, JS, images) from dist folder
app.use(express.static(path.join(__dirname, '../dist')));
app.listen(PORT, () => {
console.log(`Server running on port ${PORT}`);
console.log('Dynamic SEO enabled!');
});
export default app;