<commit_before>const bodyParser = require('body-parser');
const express = require('express');
const multer = require('multer');
const _ = require('underscore')

dataKeys = [ 'name', 'occupation', 'weapon' ];

function createServer (data) {
  var app = express();

  app.use(function (req, res, next) {
      res.header('Access-Control-Allow-Origin', '*');
      res.header('Access-Control-Allow-Headers', 'Origin, X-Requested-With, Content-Type, Accept');
      next();
  });

  app.use(multer().array());
  app.use(bodyParser.urlencoded({ extended: true }));
  app.use(bodyParser.json());

  app.get('/characters', function (req, res) {
      res.send(data);
  });

  app.delete('/characters/:id', function(req, res){
      var id = Number(req.params.id);
      var charExists = false;
      var new_data = _.reject(data, function(character){
          if (character.id === id){
              charExists = true;
              return character.id === id;
          } else {
              return false;
          }
      })<commit_msg>Fix jQuery complaining about HTTP verbs<commit_after>const bodyParser = require('body-parser');
const express = require('express');
const multer = require('multer');
const _ = require('underscore')

dataKeys = [ 'name', 'occupation', 'weapon' ];

function createServer (data) {
  var app = express();

  app.use(function (req, res, next) {
      res.header('Access-Control-Allow-Origin', '*');
      res.header('Access-Control-Allow-Methods', 'DELETE,GET,HEAD,PATCH,PUT');
      res.header('Access-Control-Allow-Headers', 'Origin, X-Requested-With, Content-Type, Accept');
      next();
  });

  app.use(multer().array());
  app.use(bodyParser.urlencoded({ extended: true }));
  app.use(bodyParser.json());

  app.get('/characters', function (req, res) {
      res.send(data);
  });

  app.delete('/characters/:id', function(req, res){
      var id = Number(req.params.id);
      var charExists = false;
      var new_data = _.reject(data, function(character){
          if (character.id === id){
              charExists = true;
              return character.id === id;
          } else {
              return false;
          }
      })
{'fraction_non_alphanumeric': 0.17303267372296363, 'fraction_numerical': 0.0, 'mean_word_length': 2.9671532846715327, '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': '160871', 'n_tokens_mistral': 661, 'n_tokens_neox': 651, 'n_words': 139}