@@ -396,7 +396,7 @@ app.use('/assets', express.static(path.resolve(__dirname, '../assets')));
396
396
app . use ( '/assets' , express . static ( path . resolve ( __dirname , '../dist/assets' ) ) ) ;
397
397
app . use ( compression ( ) ) ;
398
398
399
- app . all ( '* ' , ( request , response , next ) => {
399
+ app . all ( '/{*splat} ' , ( request , response , next ) => {
400
400
const start = Date . now ( ) ;
401
401
402
402
response . once ( 'finish' , ( ) => {
@@ -425,13 +425,13 @@ app.get('/fontSize.css', (_, res) => {
425
425
To enable testing in the mobile device emulators,
426
426
this route handler adds compatability with DCR's route for apps articles.
427
427
The DCR route follows the pattern:
428
- / AppsArticle/https://www.theguardian.com/cities/2019/sep/13/reclaimed-lakes-and-giant-airports-how-mexico-city-might-have-looked
428
+ AppsArticle/https://www.theguardian.com/food/2020/mar/15/easter-taste-test-dan-lepard-hot-cross-bun-milk-dark-chocolate-mini-eggs-bunny-sloth
429
429
*/
430
430
app . get (
431
- '/AppsArticle/*' ,
431
+ '/AppsArticle/*url ' ,
432
432
express . raw ( ) ,
433
433
( req , res , next ) => {
434
- const contentWebUrl = req . params [ 0 ] ;
434
+ const contentWebUrl = req . originalUrl . split ( '/' ) . slice ( 2 ) . join ( '/' ) ;
435
435
const articleId = new URL ( contentWebUrl ) . pathname ;
436
436
req . params = {
437
437
0 : articleId ,
@@ -443,16 +443,13 @@ app.get(
443
443
) ;
444
444
445
445
app . get (
446
- '/:edition(uk|us|au|europe|international)?/rendered-items/*' ,
447
- express . raw ( ) ,
448
- serveArticleGet ,
449
- ) ;
450
- app . get (
451
- '/:edition(uk|us|au|europe|international)?/*' ,
446
+ [ '/:edition/rendered-items/*path' , '/rendered-items/*path' ] ,
452
447
express . raw ( ) ,
453
448
serveArticleGet ,
454
449
) ;
455
450
451
+ app . get ( [ '/:edition/*path' , '/*path' ] , express . raw ( ) , serveArticleGet ) ;
452
+
456
453
app . post ( '/article' , express . raw ( ) , serveArticlePost ) ;
457
454
458
455
app . post ( '/editions-article' , express . raw ( ) , serveEditionsArticlePost ) ;
0 commit comments