|
|
|
@ -11,6 +11,7 @@ import { NextFunction, Request, Response } from 'express';
|
|
|
|
|
export class FrontendMiddleware implements NestMiddleware {
|
|
|
|
|
public indexHtmlDe = '';
|
|
|
|
|
public indexHtmlEn = '';
|
|
|
|
|
public indexHtmlIt = '';
|
|
|
|
|
public isProduction: boolean;
|
|
|
|
|
|
|
|
|
|
public constructor(
|
|
|
|
@ -32,6 +33,10 @@ export class FrontendMiddleware implements NestMiddleware {
|
|
|
|
|
this.getPathOfIndexHtmlFile(DEFAULT_LANGUAGE_CODE),
|
|
|
|
|
'utf8'
|
|
|
|
|
);
|
|
|
|
|
this.indexHtmlIt = fs.readFileSync(
|
|
|
|
|
this.getPathOfIndexHtmlFile('it'),
|
|
|
|
|
'utf8'
|
|
|
|
|
);
|
|
|
|
|
} catch {}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -61,6 +66,15 @@ export class FrontendMiddleware implements NestMiddleware {
|
|
|
|
|
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 {
|
|
|
|
|
res.send(
|
|
|
|
|
this.interpolate(this.indexHtmlEn, {
|
|
|
|
|