<commit_before>const express = require('express');
const bodyParser = require('body-parser');
const fallback = require('express-history-api-fallback');
const webpack = require('webpack');
const config = require('./webpack.config');
const webpackDevMiddleware = require('webpack-dev-middleware');
const webpackHotMiddleware = require('webpack-hot-middleware');

const app = express();
const root = `${__dirname}/src/client/public`;
const port = process.env.PORT || 3000;

// webpack watch setup
const compiler = webpack(config);
app.use(webpackDevMiddleware(compiler, {
  publicPath: config.output.publicPath,
  stats: {
    colors: true
  },
  noInfo: true
}));

app.use(webpackHotMiddleware(compiler, {
    log: console.log
}));

app.use(bodyParser.json()); // for parsing application/json
app.use(bodyParser.urlencoded({ extended: true })); // for parsing application/x-www-form-urlencoded
// webpack is okay with this static serving
app.use(express.static(root)); // static files
app.use(fallback('index.html', {root}));

app.listen(port, () =>{
	console.log(`Drunken Genius sippen on: ${port}`);
});


// https://github.com/tradersquare/tradersquare/blob/develop/server/server.js<commit_msg>(refactor) Added environment variable for port 3000 on local and port 80 on digital droplet<commit_after>const express = require('express');
const bodyParser = require('body-parser');
const fallback = require('express-history-api-fallback');
const webpack = require('webpack');
const config = require('./webpack.config');
const webpackDevMiddleware = require('webpack-dev-middleware');
const webpackHotMiddleware = require('webpack-hot-middleware');
require('dotenv').config();

const app = express();
const root = `${__dirname}/src/client/public`;
const port = process.env.NODE_DEV || process.env.NODE_PROD;

// webpack watch setup
const compiler = webpack(config);
app.use(webpackDevMiddleware(compiler, {
  publicPath: config.output.publicPath,
  stats: {
    colors: true
  },
  noInfo: true
}));

app.use(webpackHotMiddleware(compiler, {
    log: console.log
}));

app.use(bodyParser.json()); // for parsing application/json
app.use(bodyParser.urlencoded({ extended: true })); // for parsing application/x-www-form-urlencoded
// webpack is okay with this static serving
app.use(express.static(root)); // static files
app.use(fallback('index.html', {root}));

app.listen(port, () =>{
	console.log(`<NAME> on: ${port}`);
});


// https://github.com/tradersquare/tradersquare/blob/develop/server/server.js
{'fraction_non_alphanumeric': 0.16147082334132695, 'fraction_numerical': 0.003996802557953637, 'mean_word_length': 5.434447300771208, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 6, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, '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': '6733035', 'n_tokens_mistral': 758, 'n_tokens_neox': 753, 'n_words': 166}