<commit_before>var express = require('express');
var bodyParser = require('body-parser');
var session = require('express-session');
var passport = require('passport');
var sockets = require('./routes/sockets.js');
var auth = require('./auth/auth.js');

require('./db/index.js')(launchServer);

function launchServer() {
  var app = express();

// ZACH: have a routes file

  app.use(session({
    secret: 'victoriousresistance',
    resave: true,
    saveUninitialized: false,
  }));

  app.use(bodyParser.json());
  app.use(bodyParser.urlencoded({ extended: true }));

  app.use(passport.initialize());
  app.use(passport.session());

  //router and sockets
  require('./routes/webRoutes.js')(app, express);
  app.use('/api',
    // auth.checkAuth,
    require('./routes/apiRoutes.js'));

// ZACH: sockets in a different file
  var server = require('https').createServer(app);
  sockets(server);

  //twilio
  require('./routes/twilio.js')(app);
  
  var ports = process.env.PORT ? [80, 443] : [3000, 5678];

  server.listen(ports[1], function() {
    console.log('iDioma listening on port: ' + ports[1]);
  });
  app.listen(ports[0]);
}
<commit_msg>Configure server settings<commit_after>var express = require('express');
var bodyParser = require('body-parser');
var session = require('express-session');
var passport = require('passport');
var sockets = require('./routes/sockets.js');
var auth = require('./auth/auth.js');
var fs = require('fs');

require('./db/index.js')(launchServer);

function launchServer() {
  var app = express();

// ZACH: have a routes file

  app.use(session({
    secret: 'victoriousresistance',
    resave: true,
    saveUninitialized: false,
  }));

  app.use(bodyParser.json());
  app.use(bodyParser.urlencoded({ extended: true }));

  app.use(passport.initialize());
  app.use(passport.session());

  //router and sockets
  require('./routes/webRoutes.js')(app, express);
  app.use('/api',
    // auth.checkAuth,
    require('./routes/apiRoutes.js'));

// ZACH: sockets in a different file
  var server = require('https').createServer(
    {
      key: fs.readFileSync('./tls/key.pem'),
      cert: fs.readFileSync('./tls/cert.pem'),
    },
    app);
  sockets(server);

  //twilio
  require('./routes/twilio.js')(app);
  
  var ports = process.env.PORT ? [80, 443] : [3000, 5678];

  server.listen(ports[1], function() {
    console.log('iDioma listening on port: ' + ports[1]);
  });
  app.listen(ports[0], function() {
    console.log('iDioma listening on port: ' + ports[0]);
  });
}

{'fraction_non_alphanumeric': 0.19175911251980982, 'fraction_numerical': 0.013074484944532488, 'mean_word_length': 3.88394584139265, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '61710', 'n_tokens_mistral': 859, 'n_tokens_neox': 828, 'n_words': 170}