<commit_before>
var https = require('https');
var fs = require('fs');

var express = require('express');
var detect = require('./lib/detect');
var argv = require('optimist')
  .boolean('s')
  .alias('s', 'secure')
  .describe('s', 'Start an HTTPS server.')
  .alias('p', 'port')
  .describe('p', 'Port to run server on.')
  .default('p', 3000)
  .argv;

var app = express();

app.configure(function () {
  app.use( express.static(__dirname + '/public') );
});

app.get('/detect/features', function (req, res) {
  detect.features(req.query.url, function (err, features) {
    res.jsonp({ error : err || false, features : features || {} });
  });
});

if (argv.secure) {
  var options = {
    key : fs.readFileSync('./ssl/rp-key.pem').toString(),
    cert : fs.readFileSync('./ssl/rp-cert.pem').toString()
  };

  require('https').createServer(options, app).listen(app.get('port'), function(){
    console.log("Express server listening on port " + app.get('port'));
  });
}
else {
  app.listen(argv.port);
  console.log('Listening on port', argv.port);
}<commit_msg>Option to start both http and https servers.<commit_after>
var https = require('https');
var http = require('http');
var fs = require('fs');

var express = require('express');
var detect = require('./lib/detect');
var argv = require('optimist')
  .boolean('s')
  .alias('s', 'secure')
  .describe('s', 'Start an HTTPS server.')
  .alias('p', 'port')
  .describe('p', 'Port to run server on.')
  .default('p', 3000)
  .argv;

var app = express();

app.configure(function () {
  app.use( express.static(__dirname + '/public') );
});

app.get('/detect/features', function (req, res) {
  detect.features(req.query.url, function (err, features) {
    res.jsonp({ error : err || false, features : features || {} });
  });
});

if (argv.secure) {
  var options = {
    key : fs.readFileSync('./ssl/key.pem').toString(),
    cert : fs.readFileSync('./ssl/cert.pem').toString()
  };

  require('https').createServer(options, app).listen(8443, function () {
    console.log('secure server listening on port 443');
  });
}

http.createServer(app).listen(argv.port);
console.log('server listening on port', argv.port);
{'fraction_non_alphanumeric': 0.21244239631336406, 'fraction_numerical': 0.0069124423963133645, 'mean_word_length': 4.0606060606060606, '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': '6142057', 'n_tokens_mistral': 730, 'n_tokens_neox': 709, 'n_words': 168}