Skip to content

Commit 38ab43d

Browse files
committed
add rendered-items-assets to the router
1 parent 2810054 commit 38ab43d

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

dotcom-rendering/src/server/server.dev.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import { type Handler, Router } from 'express';
1+
import nodePath from 'node:path';
2+
import { type Handler, Router, static as static_ } from 'express';
23
import { pages } from '../devServer/routers/pages';
34
import { targets } from '../devServer/routers/targets';
45
import { handleAllEditorialNewslettersPage } from './handler.allEditorialNewslettersPage.web';
@@ -119,6 +120,11 @@ renderer.post('/FootballTablesPage', handleFootballTablesPage);
119120
renderer.post('/CricketMatchPage', handleCricketMatchPage);
120121
renderer.post('/FootballMatchSummaryPage', handleFootballMatchPage);
121122

123+
renderer.get(
124+
'/assets',
125+
static_(nodePath.resolve(__dirname, '../dist/rendered-items-assets.html')),
126+
);
127+
122128
const router = Router();
123129
router.use('/pages', pages);
124130
router.use('/targets', targets);

dotcom-rendering/src/server/server.prod.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import path from 'node:path';
12
import compression from 'compression';
23
import type { ErrorRequestHandler, Request, Response } from 'express';
34
import express from 'express';
@@ -85,6 +86,12 @@ export const prodServer = (): void => {
8586
app.post('/AppsBlocks', logRenderTime, handleAppsBlocks);
8687
app.post('/EditionsCrossword', logRenderTime, handleEditionsCrossword);
8788

89+
app.get('/assets/rendered-items-assets.html', (req, res) => {
90+
res.sendFile(
91+
path.resolve(__dirname, './dist/rendered-items-assets.html'),
92+
);
93+
});
94+
8895
// All params to error handlers must be declared for express to identify them as error middleware
8996
// https://expressjs.com/en/api.html#:~:text=Error%2Dhandling%20middleware%20always,see%3A%20Error%20handling
9097
// eslint-disable-next-line @typescript-eslint/no-unused-vars -- all params to error handlers must be declared

0 commit comments

Comments
 (0)