<commit_before>var express = require('express');
var index = require('./routes/index');

var debug = require('debug')('absolute-signage:server');

var fs = require('fs');
var http = require('http');
var https = require('https');
var app = express();

// CERTI_FILE FOR HTTPS
var options = {
  key: fs.readFileSync('./certi/key.pem'),
  cert: fs.readFileSync('./certi/cert.pem')
};

app.use('/', index);

// catch 404 and forward to error handler
app.use(function(req, res, next) {
  var err = new Error('Not Found');
  err.status = 404;
  next(err);
});

// error handler
app.use(function(err, req, res, next) {
  // set locals, only providing error in development
  res.locals.message = err.message;
  res.locals.error = req.app.get('env') === 'development' ? err : {};

  // render the error page
  res.status(err.status || 500);
  res.render('error');
});

module.exports = app;

var port = normalizePort(process.env.PORT || '3000');
app.set('port', port);

var server = https.createServer(options, app);

server.listen(port);
server.on('error', onError);
server.on('listening', onListening);
<commit_msg>Fix server exception issue. (#27)<commit_after>var express = require('express');
var index = require('./routes/index');

var debug = require('debug')('absolute-signage:server');

var fs = require('fs');
var http = require('http');
var https = require('https');
var app = express();

// CERTI_FILE FOR HTTPS
var options = {
  key: fs.readFileSync('./certi/key.pem'),
  cert: fs.readFileSync('./certi/cert.pem')
};

app.use('/', index);

// catch 404 and forward to error handler
app.use(function(req, res, next) {
  var err = new Error('Not Found');
  err.status = 404;
  next(err);
});

// error handler
app.use(function(err, req, res, next) {
  // set locals, only providing error in development
  res.locals.message = err.message;
  res.locals.error = req.app.get('env') === 'development' ? err : {};

  res.status(err.status || 500);
});

module.exports = app;

var port = normalizePort(process.env.PORT || '3000');
app.set('port', port);

var server = https.createServer(options, app);

server.listen(port);
server.on('error', onError);
server.on('listening', onListening);

{'fraction_non_alphanumeric': 0.19030192131747484, 'fraction_numerical': 0.012808783165599268, 'mean_word_length': 4.426799007444169, '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': '5902119', 'n_tokens_mistral': 755, 'n_tokens_neox': 723, 'n_words': 185}