<commit_before>/**
 * Bootstraps and starts the http server
 */
  
'use strict';

/**
 * Module dependencies
 * @private
 */
var connect = require('connect');
var http = require('http');
var morgan = require('morgan');
var qs = require('qs');

var parse = require('./parse');
var calculate = require('./calculate');

/**
 * Configure connect app and start http server
 */

module.exports = function() {
  var app = connect();

  // Log all incoming requests to the console
  app.use(morgan('common'));

  app.use('/calculate', function(req, res, next) {
    if(req.method === 'GET') {
      var params = qs.parse(req.url.substring(2));
      parse(params.expression, function(err, firstNumber, operator, secondNumber) {
        if(err) {
          res.statusCode = 422;
          return res.end(err);
        }

        var result = calculate(firstNumber, operator, secondNumber);
        res.end(result + '');
      });
      
    }
  });
  // Create server and listen on port 3000
  http.createServer(app).listen(3000);

  return app;
};<commit_msg>Fix line too long error<commit_after>/**
 * Bootstraps and starts the http server
 */
  
'use strict';

/**
 * Module dependencies
 * @private
 */
var connect = require('connect');
var http = require('http');
var morgan = require('morgan');
var qs = require('qs');

var parse = require('./parse');
var calculate = require('./calculate');

/**
 * Configure connect app and start http server
 */

module.exports = function() {
  var app = connect();

  // Log all incoming requests to the console
  app.use(morgan('common'));

  app.use('/calculate', function(req, res) {
    if(req.method === 'GET') {
      var params = qs.parse(req.url.substring(2));
      parse(params.expression, function(err, firstNum, operator, secondNum) {
        if(err) {
          res.statusCode = 422;
          return res.end(err);
        }

        var result = calculate(firstNum, operator, secondNum);
        res.end(result + '');
      });
      
    }
  });
  // Create server and listen on port 3000
  http.createServer(app).listen(3000);

  return app;
};
{'fraction_non_alphanumeric': 0.15807067812798473, 'fraction_numerical': 0.011461318051575931, 'mean_word_length': 2.908582089552239, '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': '7343473', 'n_tokens_mistral': 649, 'n_tokens_neox': 620, 'n_words': 173}