<commit_before>var express = require('express');
var router = express.Router();
var mongoose = require('mongoose');

// GET /site
router.get('/site', function(req, res, next) {
  mongoose.model('site').find(function(err, sites) {
    if (err) {
      console.log(err);
    } else {
      res.send(sites);
    }
  });
});

// GET /site/:id
router.get('/site/:id', function(req, res, next) {
  mongoose.model('site').findOne({ _id: req.params.id }, function(err, sites) {
    if (err) {
      console.log(err);
    } else {
      res.send(sites);
    }
  });
});

// PUT /site/:id
router.put('/site/:id', function(req, res, next) {
  // @TODO: add param verification
  mongoose.model('site').findByIdAndUpdate(req.params.id, req.body, function(err, site) {
    if (err) {
      console.log(err);
    } else {
      res.send(site);
    }
  });
});

// POST /site
router.post('/site', function(req, res, next) {
  var Site = require('../models/site');
  var data = req.body;

  // @TODO: add param verification
  var site = new Site({
    name: data.name,
    login: data.login,
    password: <PASSWORD>,
    fields: data.fields
  });

  site.save(function(err, site) {
    if (err) {
      console.log(err);
    } else {
      res.send(site);
    }
  });
});

module.exports = router;<commit_msg>Updating site endpoints for plurality.<commit_after>var express = require('express');
var router = express.Router();
var mongoose = require('mongoose');

// GET /sites
router.get('/sites', function(req, res) {
  mongoose.model('site').find(function(err, sites) {
    if (err) {
      console.log(err);
    } else {
      res.send(sites);
    }
  });
});

// GET /sites/:id
router.get('/sites/:id', function(req, res) {
  mongoose.model('site').findOne({ _id: req.params.id }, function(err, sites) {
    if (err) {
      console.log(err);
    } else {
      res.send(sites);
    }
  });
});

// PUT /sites/:id
router.put('/sites/:id', function(req, res) {
  // @TODO: add param verification
  mongoose.model('site').findByIdAndUpdate(req.params.id, req.body, function(err, site) {
    if (err) {
      console.log(err);
    } else {
      res.send(site);
    }
  });
});

// POST /site
router.post('/sites', function(req, res) {
  var Site = require('../models/site');
  var data = req.body;

  // @TODO: add param verification
  var site = new Site({
    name: data.name,
    login: data.login,
    password: <PASSWORD>,
    fields: data.fields
  });

  site.save(function(err, site) {
    if (err) {
      console.log(err);
    } else {
      res.send(site);
    }
  });
});

module.exports = router;
{'fraction_non_alphanumeric': 0.19622205088666153, 'fraction_numerical': 0.0, 'mean_word_length': 2.75, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '1147376', 'n_tokens_mistral': 927, 'n_tokens_neox': 924, 'n_words': 187}