<commit_before>var express = require('express');
var http = require('http');
var https = require('https');
var path = require('path');
var util = require('util');
var fs = require('fs');
var config = require('./config').config;
var mysql = require('mysql').createPool(config.mysql);
var MySQLStore = require('connect-mysql')(express);
var UserStore = require("./user.js");
var OidcStore = require("./oidc.js");

var User = new UserStore({ client: mysql, tables: ['tb_user', 'tb_user_info', 'tb_oidc'] });
var Oidc = new OidcStore({ client: mysql, tables: ['tb_oidc', 'tb_user'] });

var ssl_options = new Object();

if (config.server.secure) {
  var ssl_key = fs.readFileSync('keys/ssl.key');
  var ssl_cert = fs.readFileSync('keys/ssl.crt');
  var ssl_ca = fs.readFileSync('keys/signing-ca-1.crt');

  ssl_options.key = ssl_key;
  ssl_options.cert = ssl_cert;
  ssl_options.ca = ssl_ca;
}

var app_redirect = express();

app_redirect.configure(function() {
  app_redirect.set('port', process.env.PORT || config.server.http_port);
  app_redirect.use(express.favicon(__dirname + '/public/favicon.ico'));
  app_redirect.use(app_redirect.router);
});

var app = express();

var passport = require('passport');

app.config = config;
app.User = User;
app.Oidc = Oidc;

// all environments
app.set('port', process.env.PORT || (config.server.secure ? config.server.https_port : config.server.http_port));
app.set('views', path.join(__dirname, 'views'));
app.set('view engine', 'ejs');
app.use(express.favicon(__dirname + '/public/favicon.ico'));
app.use(express.logger('dev'));
app.use(express.json());
app.use(express.urlencoded());
app.use(express.methodOverride());
app.use(express.cookieParser(config.server.cookie_parser));
app.use(express.session({
  secret: config.server.session_secret,
  store: new MySQLStore({ client: mysql, table: 'tb_session' }),
  cookie: {
    secure: (config.server.secure ? true : false),
    maxAge: 60*60000 //60 minutes
  },
  rolling : true
}));
app.use(passport.initialize());
app.use(passport.session());
app.use(app.router);
app.use(express.static(path.join(__dirname, 'public')));

var routes = require('./routes')(app);

app.use(function(req, res) {
  res.render('403.ejs', {title: '403: Forbidden'});
});<commit_msg>do not use bodyParser or urlencoded<commit_after>var express = require('express');
var http = require('http');
var https = require('https');
var path = require('path');
var util = require('util');
var fs = require('fs');
var config = require('./config').config;
var mysql = require('mysql').createPool(config.mysql);
var MySQLStore = require('connect-mysql')(express);
var UserStore = require("./user.js");
var OidcStore = require("./oidc.js");

var User = new UserStore({ client: mysql, tables: ['tb_user', 'tb_user_info', 'tb_oidc'] });
var Oidc = new OidcStore({ client: mysql, tables: ['tb_oidc', 'tb_user'] });

var ssl_options = new Object();

if (config.server.secure) {
  var ssl_key = fs.readFileSync('keys/ssl.key');
  var ssl_cert = fs.readFileSync('keys/ssl.crt');
  var ssl_ca = fs.readFileSync('keys/signing-ca-1.crt');

  ssl_options.key = ssl_key;
  ssl_options.cert = ssl_cert;
  ssl_options.ca = ssl_ca;
}

var app_redirect = express();

app_redirect.configure(function() {
  app_redirect.set('port', process.env.PORT || config.server.http_port);
  app_redirect.use(express.favicon(__dirname + '/public/favicon.ico'));
  app_redirect.use(app_redirect.router);
});

var app = express();

var passport = require('passport');

app.config = config;
app.User = User;
app.Oidc = Oidc;

// all environments
app.set('port', process.env.PORT || (config.server.secure ? config.server.https_port : config.server.http_port));
app.set('views', path.join(__dirname, 'views'));
app.set('view engine', 'ejs');
app.use(express.favicon(__dirname + '/public/favicon.ico'));
app.use(express.logger('dev'));
app.use(express.json()); //???
// do not use!
//app.use(express.urlencoded());
// do not use!
//apps.use(express.bodyParser());
app.use(express.methodOverride());
app.use(express.cookieParser(config.server.cookie_parser));
app.use(express.session({
  secret: config.server.session_secret,
  store: new MySQLStore({ client: mysql, table: 'tb_session' }),
  cookie: {
    secure: (config.server.secure ? true : false),
    maxAge: 60*60000 //60 minutes
  },
  rolling : true
}));
app.use(passport.initialize());
app.use(passport.session());
app.use(app.router);
app.use(express.static(path.join(__dirname, 'public')));

var routes = require('./routes')(app);

app.use(function(req, res) {
  res.render('403.ejs', {title: '403: Forbidden'});
});
{'fraction_non_alphanumeric': 0.19304347826086957, 'fraction_numerical': 0.006956521739130435, 'mean_word_length': 5.408077994428969, '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': '2899830', 'n_tokens_mistral': 1615, 'n_tokens_neox': 1575, 'n_words': 312}