@ -50,66 +50,66 @@ export class FrontendMiddleware implements NestMiddleware {
} catch { }
}
public use ( req : Request , res : Response , next : NextFunction ) {
public use ( req uest : Request , res ponse : Response , next : NextFunction ) {
let featureGraphicPath = 'assets/cover.png' ;
if ( req . path . startsWith ( '/en/blog/2022/08/500-stars-on-github' ) ) {
if ( req uest . path . startsWith ( '/en/blog/2022/08/500-stars-on-github' ) ) {
featureGraphicPath = 'assets/images/blog/500-stars-on-github.jpg' ;
} else if ( req . path . startsWith ( '/en/blog/2022/10/hacktoberfest-2022' ) ) {
} else if ( req uest . path . startsWith ( '/en/blog/2022/10/hacktoberfest-2022' ) ) {
featureGraphicPath = 'assets/images/blog/hacktoberfest-2022.png' ;
} else if ( req . path . startsWith ( '/en/blog/2022/11/black-friday-2022' ) ) {
} else if ( req uest . path . startsWith ( '/en/blog/2022/11/black-friday-2022' ) ) {
featureGraphicPath = 'assets/images/blog/black-friday-2022.jpg' ;
}
if (
req . path . startsWith ( '/api/' ) ||
this . isFileRequest ( req . url ) ||
req uest . path . startsWith ( '/api/' ) ||
this . isFileRequest ( req uest . url ) ||
! this . isProduction
) {
// Skip
next ( ) ;
} else if ( req . path === '/de' || req . path . startsWith ( '/de/' ) ) {
res . send (
} else if ( req uest . path === '/de' || req uest . path . startsWith ( '/de/' ) ) {
res ponse . send (
this . interpolate ( this . indexHtmlDe , {
featureGraphicPath ,
languageCode : 'de' ,
path : req .path,
path : req uest .path,
rootUrl : this.configurationService.get ( 'ROOT_URL' )
} )
) ;
} else if ( req . path === '/es' || req . path . startsWith ( '/es/' ) ) {
res . send (
} else if ( req uest . path === '/es' || req uest . path . startsWith ( '/es/' ) ) {
res ponse . send (
this . interpolate ( this . indexHtmlEs , {
featureGraphicPath ,
languageCode : 'es' ,
path : req .path,
path : req uest .path,
rootUrl : this.configurationService.get ( 'ROOT_URL' )
} )
) ;
} else if ( req . path === '/it' || req . path . startsWith ( '/it/' ) ) {
res . send (
} else if ( req uest . path === '/it' || req uest . path . startsWith ( '/it/' ) ) {
res ponse . send (
this . interpolate ( this . indexHtmlIt , {
featureGraphicPath ,
languageCode : 'it' ,
path : req .path,
path : req uest .path,
rootUrl : this.configurationService.get ( 'ROOT_URL' )
} )
) ;
} else if ( req . path === '/nl' || req . path . startsWith ( '/nl/' ) ) {
res . send (
} else if ( req uest . path === '/nl' || req uest . path . startsWith ( '/nl/' ) ) {
res ponse . send (
this . interpolate ( this . indexHtmlNl , {
featureGraphicPath ,
languageCode : 'nl' ,
path : req .path,
path : req uest .path,
rootUrl : this.configurationService.get ( 'ROOT_URL' )
} )
) ;
} else {
res . send (
res ponse . send (
this . interpolate ( this . indexHtmlEn , {
featureGraphicPath ,
languageCode : DEFAULT_LANGUAGE_CODE ,
path : req .path,
path : req uest .path,
rootUrl : this.configurationService.get ( 'ROOT_URL' )
} )
) ;