<commit_before>var express = require('express');
var cookieParser = require('cookie-parser');
var bodyParser = require('body-parser');
var cookieSession = require('cookie-session');
var colors = require('colors');
var Db = require('./src/server/lib/database/db');
var dbUtils = require('./src/server/lib/database/dbUtils');
var expressReactViews = require('express-react-views');
var passport = require('passport');
var setupGoogleStrategy = require('./src/server/passport/googleStrategy');

var appConfig = require('./app/appConfig');
var db = new Db(appConfig);

var app = express();
app.set('views', './src/server/views');
app.set('view engine', 'jsx');
app.engine('jsx', expressReactViews.createEngine({beautify: true}));

passport.serializeUser(function (userId, done) {
    done(null, userId);
});

passport.deserializeUser(function (userId, done) {
    let repo = db.getRepository('user');
    repo.find({id: userId})
        .then(u => done(null, u))
        .catch(done);
});
passport.use(setupGoogleStrategy(db));

app.use(express.static('./dist'));
app.use(cookieParser());
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({<commit_msg>Fixing a TypeError bug<commit_after>var express = require('express');
var cookieParser = require('cookie-parser');
var bodyParser = require('body-parser');
var cookieSession = require('cookie-session');
var colors = require('colors');
var Db = require('./src/server/lib/database/db');
var dbUtils = require('./src/server/lib/database/dbUtils');
var expressReactViews = require('express-react-views');
var passport = require('passport');
var setupGoogleStrategy = require('./src/server/passport/googleStrategy');

var appConfig = require('./app/appConfig');
var db = new Db(appConfig);

var app = express();
app.set('views', './src/server/views');
app.set('view engine', 'jsx');
app.engine('jsx', expressReactViews.createEngine({beautify: true}));

passport.serializeUser(function (userId, done) {
    done(null, userId);
});

passport.deserializeUser(function (userId, done) {
    let repo = db.getRepository('user');
    repo.load({id: userId})
        .then(u => done(null, u))
        .catch(done);
});
passport.use(setupGoogleStrategy(db));

app.use(express.static('./dist'));
app.use(cookieParser());
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({
{'fraction_non_alphanumeric': 0.1887117621714778, 'fraction_numerical': 0.0, 'mean_word_length': 5.75, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '1802454', 'n_tokens_mistral': 704, 'n_tokens_neox': 711, 'n_words': 142}