<commit_before>import 'babel-register';
import React from 'react';
import { renderToString } from 'react-dom/server';
import { match, RouterContext } from 'react-router';
import express from 'express';
import path from 'path';
import pug from 'pug';
import webpack from 'webpack';
import webpackConfig from '../webpack.config.dev.js';

import routes from '../src/routes';

const env = process.env.NODE_ENV || 'development';
const isDev = env === 'development';
const port = process.env.PORT || 3000;
const compiler = webpack(webpackConfig);
const app = express();

app.use(express.static(__dirname + '/public'));
app.set('view engine', 'pug');

if (isDev) {
	app.use(require('webpack-hot-middleware')(compiler));
	app.use(require('webpack-dev-middleware')(compiler, {
		noInfo: true,
		publicPath: webpackConfig.output.publicPath
	}));
}

app.get('*', function (req, res) {
	match({ routes, location: req.url }, (error, redirectLocation, renderProps) => {
    if (renderProps) {
			res.render('index', {
		  	env,
				content: renderToString(<RouterContext {...renderProps} />)
		  });
    } else {
			res.render('index', {
		  	env,
				content: 'Oops, something went wrong'
		  });
    }
  });
});

app.listen(port, 'localhost', function(err) {
  if (err) {
    console.log(err);
    return false;
  }

  console.log(`Listening at http://localhost:${port}`);
});<commit_msg>add port to the template context variables<commit_after>import 'babel-register';
import React from 'react';
import { renderToString } from 'react-dom/server';
import { match, RouterContext } from 'react-router';
import express from 'express';
import path from 'path';
import pug from 'pug';
import webpack from 'webpack';

import webpackConfig from '../webpack.config.dev.js';
import routes from './routes';

const env = process.env.NODE_ENV || 'development';
const isDev = env === 'development';
const port = process.env.PORT || 3000;
const compiler = webpack(webpackConfig);
const app = express();

app.use(express.static(__dirname + '/public'));
app.set('view engine', 'pug');

if (isDev) {
	app.use(require('webpack-hot-middleware')(compiler));
	app.use(require('webpack-dev-middleware')(compiler, {
		noInfo: true,
		publicPath: webpackConfig.output.publicPath
	}));
}

app.get('*', function (req, res) {
	match({ routes, location: req.url }, (error, redirectLocation, renderProps) => {
    if (renderProps) {
			res.render('index', {
		  	env,
				port,
				content: renderToString(<RouterContext {...renderProps} />)
		  });
    } else {
			res.render('index', {
		  	env,
				port,
				content: 'Oops, something went wrong'
		  });
    }
  });
});

app.listen(port, 'localhost', function(err) {
  if (err) {
    console.log(err);
    return false;
  }

  console.log(`Listening at http://localhost:${port}`);
});
{'fraction_non_alphanumeric': 0.17310443490701002, 'fraction_numerical': 0.002861230329041488, 'mean_word_length': 4.22803738317757, 'pattern_counts': {'":': 0, '<': 5, '<?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': '6221802', 'n_tokens_mistral': 951, 'n_tokens_neox': 890, 'n_words': 222}