<commit_before>var router = require('ramrod')(),
  http = require('http'),
  db = require('./lib/couch.js'),
  web = require('./lib/web.js'),
  redwah = {
    version: "0.0.5",
    description: "dont trust your gut: make decisions with numbers!"
  },
  headers = {
    "Access-Control-Allow-Origin": "*",
    "Access-Control-Allow-Methods": "POST, GET, PUT, DELETE, OPTIONS",
    "Access-Control-Allow-Headers": "X-Requested-With, Access-Control-Allow-Origin, X-HTTP-Method-Override, Content-Type, Authorization, Accept"
  };

// Route handler

router.on('putlist|put', function (req, res, params) {
  console.log('put');
  web.processPost(req, function (err, params) {
    console.dir(params);
    db.insert(params.id, {
      "_rev": params.rev,
      "qualities": params.qualities,
      "items": params.items,
      "name": params.name,
      "lastModified": new Date().getTime()
    }, function (err, doc) {
      if (err) {
        console.log(err);
        return web.sendError(res, 500, headers);
      }
      res.writeHead(200, headers);
      res.end(JSON.stringify(doc));
    });
  });
});

router.on('dellist|del', function (req, res, params) {
  db.get(params.id, function (err, doc) {
    if (err) { return web.sendError(res, 404, headers); }
    db.destroy(doc.id, doc.rev, function (err) {
      if (err) { return web.sendError(res, 404, headers); }
      console.log('del request');
      res.writeHead(200, headers);
      res.end(JSON.stringify({ "ok": true }));
    });
  });
});

router.on('postlist|post', function (req, res) {
  console.log('post');
  web.processPost(req, function (err, params) {
    if (err) { return web.sendError(res, 500, headers); }
    //if (Object.keys(params).length > 1) { return false; }
    var listDocument = {
      "name": params.name
    };
    db.insert(listDocument, function (err, doc) {
      res.writeHead(201, headers);<commit_msg>fixing name and id difference<commit_after>var router = require('ramrod')(),
  http = require('http'),
  db = require('./lib/couch.js'),
  web = require('./lib/web.js'),
  redwah = {
    version: "0.0.5",
    description: "dont trust your gut: make decisions with numbers!"
  },
  headers = {
    "Access-Control-Allow-Origin": "*",
    "Access-Control-Allow-Methods": "POST, GET, PUT, DELETE, OPTIONS",
    "Access-Control-Allow-Headers": "X-Requested-With, Access-Control-Allow-Origin, X-HTTP-Method-Override, Content-Type, Authorization, Accept"
  };

// Route handler

router.on('putlist|put', function (req, res, params) {
  console.log('put');
  web.processPost(req, function (err, params) {
    console.dir(params);
    db.insert(params.id, {
      "_rev": params.rev,
      "qualities": params.qualities,
      "items": params.items,
      "name": params.name,
      "lastModified": new Date().getTime(),
      "finished": params.finished
    }, function (err, doc) {
      if (err) {
        console.log(err);
        return web.sendError(res, 500, headers);
      }
      res.writeHead(200, headers);
      res.end(JSON.stringify(doc));
    });
  });
});

router.on('dellist|del', function (req, res, params) {
  db.get(params.id, function (err, doc) {
    if (err) { return web.sendError(res, 404, headers); }
    db.destroy(doc.id, doc.rev, function (err) {
      if (err) { return web.sendError(res, 404, headers); }
      console.log('del request');
      res.writeHead(200, headers);
      res.end(JSON.stringify({ "ok": true }));
    });
  });
});

router.on('postlist|post', function (req, res) {
  console.log('post');
  web.processPost(req, function (err, params) {
    if (err) { return web.sendError(res, 500, headers); }
    db.insert(params.id, { name: params.name }, function (err, doc) {
      res.writeHead(201, headers);
{'fraction_non_alphanumeric': 0.1847099705960973, 'fraction_numerical': 0.01309810211173483, 'mean_word_length': 3.204494382022472, 'pattern_counts': {'":': 20, '<': 3, '<?xml version=': 0, '>': 4, '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': '150641', 'n_tokens_mistral': 1293, 'n_tokens_neox': 1257, 'n_words': 270}