26 lines
731 B
JavaScript
26 lines
731 B
JavaScript
|
|
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;
|
||
|
|
|
||
|
|
// Serve static files first (CSS, JS, images)
|
||
|
|
app.use(express.static(path.join(__dirname, '../dist')));
|
||
|
|
// Also mount under /home because Vite base is /home/
|
||
|
|
app.use('/home', express.static(path.join(__dirname, '../dist')));
|
||
|
|
|
||
|
|
// Apply SEO middleware for HTML routes
|
||
|
|
app.use(seoMiddleware);
|
||
|
|
|
||
|
|
app.listen(PORT, () => {
|
||
|
|
console.log(`Server running on port ${PORT}`);
|
||
|
|
console.log('Dynamic SEO enabled!');
|
||
|
|
});
|
||
|
|
|
||
|
|
export default app;
|