<commit_before>import 'reflect-metadata';
import 'zone.js/dist/zone-node';
import 'zone.js/dist/long-stack-trace-zone';
import 'systemjs';
import * as express from 'express';
import * as compression from 'compression';
import * as morgan from 'morgan';
import { join, resolve } from 'path';
import { ngExpressEngine } from '@nguniversal/express-engine';
import { AppServerModule } from './app.server.module';

const root = resolve(process.argv[1], '../');
const pkg = join(process.env.PWD, './package.json');
const settings = require(pkg).app;
const app = express();

app.use(compression());
app.use(morgan('dev'));
app.engine('html', ngExpressEngine({
  bootstrap: AppServerModule
}));
app.set('view engine', 'html');
app.set('views', join(root, '.'));
app.use('/js', express.static(join(root, './js')));
app.get('/*', (req, res) => {
  return res.render('index', {
    req,
    res,
  });
});
app.listen(settings.server.port, () => {
  console.log(`Angular Universal Server listening on port ${settings.server.port}...`);
});<commit_msg>fix: port now more dynamic<commit_after>import 'reflect-metadata';
import 'zone.js/dist/zone-node';
import 'zone.js/dist/long-stack-trace-zone';
import 'systemjs';
import * as express from 'express';
import * as compression from 'compression';
import * as morgan from 'morgan';
import { join, resolve } from 'path';
import { ngExpressEngine } from '@nguniversal/express-engine';
import { AppServerModule } from './app.server.module';

const root = resolve(process.argv[1], '../');
const pkg = join(process.env.PWD, './package.json');
const settings = require(pkg).app;
const port = process.env.PORT || settings.server.port;
const app = express();

app.use(compression());
app.use(morgan('dev'));
app.engine('html', ngExpressEngine({
  bootstrap: AppServerModule
}));
app.set('view engine', 'html');
app.set('views', join(root, '.'));
app.use('/js', express.static(join(root, './js')));
app.get('/*', (req, res) => {
  return res.render('index', {
    req,
    res,
  });
});
app.listen(port, () => {
  console.log(`Angular Universal Server listening on port ${port}...`);
});
{'fraction_non_alphanumeric': 0.20577105014191108, 'fraction_numerical': 0.000946073793755913, 'mean_word_length': 5.0256410256410255, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, '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': '1638792', 'n_tokens_mistral': 680, 'n_tokens_neox': 675, 'n_words': 164}