fix(server): enable clean URLs (/whitepapers/foo → foo.html)
Add extensions: ['html'] to express.static so the .html-less URLs resolve to their matching files. Affects every static HTML route including /whitepapers/distributive-equity, /whitepapers/eu-policy-brief, etc. .html-suffixed URLs continue to work unchanged. Non-existent paths still return the friendly 404 via the notFound middleware.
This commit is contained in:
parent
2480d73d6f
commit
f6be654573
1 changed files with 3 additions and 1 deletions
|
|
@ -135,7 +135,9 @@ const rssRoutes = require('./routes/rss.routes');
|
|||
app.use('/', rssRoutes);
|
||||
|
||||
// Static files
|
||||
app.use(express.static('public'));
|
||||
// extensions: ['html'] lets clean URLs (e.g. /whitepapers/eu-policy-brief) resolve
|
||||
// to the matching .html file. Without this, only the .html-suffixed URL works.
|
||||
app.use(express.static('public', { extensions: ['html'] }));
|
||||
|
||||
// Health check endpoint (minimal, no sensitive data)
|
||||
app.get('/health', (req, res) => {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue