|
@ -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 indexHtmlIt = ''; |
|
|
public isProduction: boolean; |
|
|
public isProduction: boolean; |
|
|
|
|
|
|
|
|
public constructor( |
|
|
public constructor( |
|
@ -32,6 +33,10 @@ export class FrontendMiddleware implements NestMiddleware { |
|
|
this.getPathOfIndexHtmlFile(DEFAULT_LANGUAGE_CODE), |
|
|
this.getPathOfIndexHtmlFile(DEFAULT_LANGUAGE_CODE), |
|
|
'utf8' |
|
|
'utf8' |
|
|
); |
|
|
); |
|
|
|
|
|
this.indexHtmlIt = fs.readFileSync( |
|
|
|
|
|
this.getPathOfIndexHtmlFile('it'), |
|
|
|
|
|
'utf8' |
|
|
|
|
|
); |
|
|
} catch {} |
|
|
} catch {} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -61,6 +66,15 @@ export class FrontendMiddleware implements NestMiddleware { |
|
|
rootUrl: this.configurationService.get('ROOT_URL') |
|
|
rootUrl: this.configurationService.get('ROOT_URL') |
|
|
}) |
|
|
}) |
|
|
); |
|
|
); |
|
|
|
|
|
} else if (req.path === '/it' || req.path.startsWith('/it/')) { |
|
|
|
|
|
res.send( |
|
|
|
|
|
this.interpolate(this.indexHtmlIt, { |
|
|
|
|
|
featureGraphicPath, |
|
|
|
|
|
languageCode: 'it', |
|
|
|
|
|
path: req.path, |
|
|
|
|
|
rootUrl: this.configurationService.get('ROOT_URL') |
|
|
|
|
|
}) |
|
|
|
|
|
); |
|
|
} else { |
|
|
} else { |
|
|
res.send( |
|
|
res.send( |
|
|
this.interpolate(this.indexHtmlEn, { |
|
|
this.interpolate(this.indexHtmlEn, { |
|
|