2025-11-13 09:53:08 +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!');
|
|
|
|
|
});
|
|
|
|
|
|
2025-11-26 11:53:58 +05:30
|
|
|
export default app;
|