|
@ -11,6 +11,7 @@ import { NextFunction, Request, Response } from 'express'; |
|
|
export class FrontendMiddleware implements NestMiddleware { |
|
|
export class FrontendMiddleware implements NestMiddleware { |
|
|
public indexHtmlDe = ''; |
|
|
public indexHtmlDe = ''; |
|
|
public indexHtmlEn = ''; |
|
|
public indexHtmlEn = ''; |
|
|
|
|
|
public indexHtmlEs = ''; |
|
|
public indexHtmlIt = ''; |
|
|
public indexHtmlIt = ''; |
|
|
public indexHtmlNl = ''; |
|
|
public indexHtmlNl = ''; |
|
|
public isProduction: boolean; |
|
|
public isProduction: boolean; |
|
@ -34,6 +35,10 @@ export class FrontendMiddleware implements NestMiddleware { |
|
|
this.getPathOfIndexHtmlFile(DEFAULT_LANGUAGE_CODE), |
|
|
this.getPathOfIndexHtmlFile(DEFAULT_LANGUAGE_CODE), |
|
|
'utf8' |
|
|
'utf8' |
|
|
); |
|
|
); |
|
|
|
|
|
this.indexHtmlEs = fs.readFileSync( |
|
|
|
|
|
this.getPathOfIndexHtmlFile('es'), |
|
|
|
|
|
'utf8' |
|
|
|
|
|
); |
|
|
this.indexHtmlIt = fs.readFileSync( |
|
|
this.indexHtmlIt = fs.readFileSync( |
|
|
this.getPathOfIndexHtmlFile('it'), |
|
|
this.getPathOfIndexHtmlFile('it'), |
|
|
'utf8' |
|
|
'utf8' |
|
@ -71,6 +76,15 @@ export class FrontendMiddleware implements NestMiddleware { |
|
|
rootUrl: this.configurationService.get('ROOT_URL') |
|
|
rootUrl: this.configurationService.get('ROOT_URL') |
|
|
}) |
|
|
}) |
|
|
); |
|
|
); |
|
|
|
|
|
} else if (req.path === '/es' || req.path.startsWith('/es/')) { |
|
|
|
|
|
res.send( |
|
|
|
|
|
this.interpolate(this.indexHtmlIt, { |
|
|
|
|
|
featureGraphicPath, |
|
|
|
|
|
languageCode: 'es', |
|
|
|
|
|
path: req.path, |
|
|
|
|
|
rootUrl: this.configurationService.get('ROOT_URL') |
|
|
|
|
|
}) |
|
|
|
|
|
); |
|
|
} else if (req.path === '/it' || req.path.startsWith('/it/')) { |
|
|
} else if (req.path === '/it' || req.path.startsWith('/it/')) { |
|
|
res.send( |
|
|
res.send( |
|
|
this.interpolate(this.indexHtmlIt, { |
|
|
this.interpolate(this.indexHtmlIt, { |
|
|