<commit_before>import 'zone.js/dist/zone-node';
import 'reflect-metadata';
import 'rxjs/Rx';

import * as express from 'express';
import {ServerAppModule} from './app/server-app.module';
import {ngExpressEngine} from './sys/ng-express-engine/express-engine';
import {ROUTES} from './routes';
import {enableProdMode} from '@angular/core';

if (process.env.NODE_ENV === 'production') {
    enableProdMode();
}

const app = express();

const frontendPort = process.env.DEFAULT_PORT || 8000;
const frontendHost = process.env.DEFAULT_HOST || `http://localhost:${frontendPort}`;
const backendHost = process.env.BACKEND_URL;

app.disable('x-powered-by');

app.engine('html', ngExpressEngine({
    bootstrap: ServerAppModule
}));

app.set('view engine', 'html');
app.set('views', 'src');

app.use('/', express.static('dist', {index: false}));

app.get('/sitemap.xml', (req, res) => res.redirect(301, `${backendHost}/sitemap.xml`));
app.get('/rss.xml', (req, res) => res.redirect(301, `${backendHost}/rss.xml`));

ROUTES.forEach(route => {
    app.get(route, (req, res) => {
        console.time(`GET: ${req.originalUrl}`);
        res.render('../dist/index', {
            req: req,
            res: res
        });
        console.timeEnd(`GET: ${req.originalUrl}`);
    });
});

app.get('*', (req, res) => res.status(404).redirect('/404'));

app.listen(frontendPort, () => {
    console.log(`Listening at ${frontendHost}`);
});
<commit_msg>[FE]. Fixed server rendering engine misconfiguration issues<commit_after>import 'zone.js/dist/zone-node';
import 'reflect-metadata';
import 'rxjs/Rx';

import * as express from 'express';
import {ServerAppModule} from './app/server-app.module';
import {ngExpressEngine} from './sys/ng-express-engine/express-engine';
import {ROUTES} from './routes';
import {enableProdMode} from '@angular/core';

if (process.env.NODE_ENV === 'production') {
    enableProdMode();
}

const app = express();

const frontendPort = process.env.DEFAULT_PORT || 8000;
const backendHost = process.env.BACKEND_URL;

app.disable('x-powered-by');

app.engine('html', ngExpressEngine({
    bootstrap: ServerAppModule
}));

app.set('view engine', 'html');
app.set('views', 'src');

app.use('/', express.static('dist', {index: false}));

app.get('/sitemap.xml', (req, res) => res.redirect(301, `${backendHost}/sitemap.xml`));
app.get('/rss.xml', (req, res) => res.redirect(301, `${backendHost}/rss.xml`));

ROUTES.forEach(route => {
    app.get(route, (req, res) => {
        console.time(`GET: ${req.originalUrl}`);
        res.render('../dist/index', {
            req: req,
            res: res
        });
        console.timeEnd(`GET: ${req.originalUrl}`);
    });
});

app.get('*', (req, res) => res.status(404).redirect('/404'));

app.listen(frontendPort, () => {
    console.log(`Listening at ${frontendPort} port.`);
});

{'fraction_non_alphanumeric': 0.21199294532627866, 'fraction_numerical': 0.011287477954144622, 'mean_word_length': 4.194139194139194, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 8}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3682849', 'n_tokens_mistral': 972, 'n_tokens_neox': 956, 'n_words': 183}