<commit_before>const express = require('express');
var cookieParser = require('cookie-parser');
var cookieSession = require('cookie-session');
const fs = require('fs');
const passport = require('passport');
const env = process.env.NODE_ENV || 'development';
const config = require('./config/config')[env];
const auth = require('./config/middlewares/authorization');
const mongoose = require('mongoose');
const app = express();
const port = process.env.PORT || 3000;

const promiseRetry = require('promise-retry');

app.use(cookieParser("super55"));
app.use(cookieSession({
  name: 'session',
  keys: ['key1', 'key2']
}));

const options = {
  useNewUrlParser: true,
  useUnifiedTopology: true,
  reconnectTries: 60,
  reconnectInterval: 1000,
  poolSize: 10,
  bufferMaxEntries: 0 // If not connected, return errors immediately rather than waiting for reconnect
};

const promiseRetryOptions = {
  retries: options.reconnectTries,
  factor: 2,
  minTimeout: options.reconnectInterval,
  maxTimeout: 5000
};

const connect = () => {
  return promiseRetry((retry, number) => {
    console.log(`MongoClient connecting to ${config.db} - retry number: ${number}`)
    return mongoose.connect(config.db, options).catch(retry)
  }, promiseRetryOptions)
};

const models_path = __dirname+'/app/models';
fs.readdirSync(models_path).forEach(file => {
  require(models_path+'/'+file);
});

require('./config/passport')(passport, config);
require('./config/express')(app, config, passport);
require('./config/routes')(app, passport, auth);

app.listen(port);
console.log('Express app started on port ' + port);

module.exports.connect = connect();
module.exports.app = app;<commit_msg>Changed module exports to pass tests<commit_after>const express = require('express');
var cookieParser = require('cookie-parser');
var cookieSession = require('cookie-session');
const fs = require('fs');
const passport = require('passport');
const env = process.env.NODE_ENV || 'development';
const config = require('./config/config')[env];
const auth = require('./config/middlewares/authorization');
const mongoose = require('mongoose');
const app = express();
const port = process.env.PORT || 3000;

const promiseRetry = require('promise-retry');

app.use(cookieParser("super55"));
app.use(cookieSession({
  name: 'session',
  keys: ['key1', 'key2']
}));

const options = {
  useNewUrlParser: true,
  useUnifiedTopology: true,
  reconnectTries: 60,
  reconnectInterval: 1000,
  poolSize: 10,
  bufferMaxEntries: 0 // If not connected, return errors immediately rather than waiting for reconnect
};

const promiseRetryOptions = {
  retries: options.reconnectTries,
  factor: 2,
  minTimeout: options.reconnectInterval,
  maxTimeout: 5000
};

const connect = () => {
  return promiseRetry((retry, number) => {
    console.log(`MongoClient connecting to ${config.db} - retry number: ${number}`)
    return mongoose.connect(config.db, options).catch(retry)
  }, promiseRetryOptions)
};

const models_path = __dirname+'/app/models';
fs.readdirSync(models_path).forEach(file => {
  require(models_path+'/'+file);
});

require('./config/passport')(passport, config);
require('./config/express')(app, config, passport);
require('./config/routes')(app, passport, auth);

app.listen(port);
console.log('Express app started on port ' + port);

connect();
module.exports = app;
{'fraction_non_alphanumeric': 0.1592814371257485, 'fraction_numerical': 0.013173652694610778, 'mean_word_length': 5.642147117296223, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, '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': '2160048', 'n_tokens_mistral': 1038, 'n_tokens_neox': 1012, 'n_words': 243}