<commit_before>var express = require('express');
var app = express();
var bodyParser = require('body-parser');
var server = require('http').createServer(app);
var mongoose = require('mongoose');

app.set('port', (process.env.PORT || 5000));

app.set('view engine', 'ejs');
app.set('views', __dirname + '/app/views');

app.use(bodyParser.json()); 

var io = require('socket.io').listen(app.listen(app.get('port'), function(){
	console.log('Server listening at port %d', app.get('port'));
}));

//Connect to the mongo database
mongoose.connect('mongodb://127.0.0.1:27017/quindar');

// CONNECTION EVENTS
// When successfully connected
mongoose.connection.on('connected', function () {
 console.log('Mongoose default connection open\n');
});

// If the connection throws an error
mongoose.connection.on('error',function (err) {
  console.log('Mongoose default connection error: ' + err + '\n');
});

// When the connection is disconnected
mongoose.connection.on('disconnected', function () {
  console.log('Mongoose default connection disconnected');
});

app.use(express.static(__dirname + '/public'));
app.use(express.static(__dirname + '/app'));

//proxy application status =====================================================
require('./server/scripts/proxyAppStatus')();

// routes ======================================================================
require('./server/routes/routes.js')(app);

// script to read socket stream ================================================
// require('./server/scripts/socket.js')(io);

// script to send and receive commands using socket stream ================================================
require('./server/scripts/commands.js')(io);<commit_msg>add global promise and useMongoClient option<commit_after>var express = require('express');
var app = express();
var bodyParser = require('body-parser');
var server = require('http').createServer(app);
var mongoose = require('mongoose');

app.set('port', (process.env.PORT || 5000));

app.set('view engine', 'ejs');
app.set('views', __dirname + '/app/views');

app.use(bodyParser.json()); 

var io = require('socket.io').listen(app.listen(app.get('port'), function(){
	console.log('Server listening at port %d', app.get('port'));
}));

mongoose.Promise = global.Promise;
//Connect to the mongo database
mongoose.connect('mongodb://127.0.0.1:27017/quindar', {useMongoClient : true});

// CONNECTION EVENTS
// When successfully connected
mongoose.connection.on('connected', function () {
 console.log('Mongoose default connection open\n');
});

// If the connection throws an error
mongoose.connection.on('error',function (err) {
  console.log('Mongoose default connection error: ' + err + '\n');
});

// When the connection is disconnected
mongoose.connection.on('disconnected', function () {
  console.log('Mongoose default connection disconnected');
});

app.use(express.static(__dirname + '/public'));
app.use(express.static(__dirname + '/app'));

//proxy application status =====================================================
require('./server/scripts/proxyAppStatus')();

// routes ======================================================================
require('./server/routes/routes.js')(app);

// script to read socket stream ================================================
// require('./server/scripts/socket.js')(io);

// script to send and receive commands using socket stream ================================================
require('./server/scripts/commands.js')(io);
{'fraction_non_alphanumeric': 0.28719424460431653, 'fraction_numerical': 0.008633093525179856, 'mean_word_length': 6.152263374485597, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, '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': '5224862', 'n_tokens_mistral': 957, 'n_tokens_neox': 919, 'n_words': 214}