<commit_before>var restify = require('restify');
var restifyMongoose = require('../index');
var Note = require('./note');

module.exports = function(options) {
  var server = restify.createServer({
    name: 'restify.mongoose.examples.notes',
    version: '1.0.0'
  });

  server.use(restify.acceptParser(server.acceptable));
  server.use(restify.queryParser());
  server.use(restify.bodyParser());

  var notes = restifyMongoose(Note, options);

  // Serve model Notes as a REST API

  server.get('/notes', notes.query());
  server.get('/notes/:id', notes.detail());
  server.post('/notes', notes.insert());
  server.patch('/notes/:id', notes.update());
  server.del('/notes/:id', notes.remove());

  server.notes = notes;

  return server;
}

<commit_msg>Allow the test server to initialize without routes.<commit_after>var restify = require('restify');
var restifyMongoose = require('../index');
var Note = require('./note');

module.exports = function(options, routes) {
  if (routes === undefined) {
    routes = true;
  }
  if (typeof options === 'boolean') {
    routes = options;
  }
  var server = restify.createServer({
    name: 'restify.mongoose.examples.notes',
    version: '1.0.0'
  });

  server.use(restify.acceptParser(server.acceptable));
  server.use(restify.queryParser());
  server.use(restify.bodyParser());

  var notes = restifyMongoose(Note, options);

  // Serve model Notes as a REST API
  if (routes) {
    server.get('/notes', notes.query());
    server.get('/notes/:id', notes.detail());
    server.post('/notes', notes.insert());
    server.patch('/notes/:id', notes.update());
    server.del('/notes/:id', notes.remove());
  }

  server.notes = notes;

  return server;
}


{'fraction_non_alphanumeric': 0.18522860492379836, 'fraction_numerical': 0.0035169988276670576, 'mean_word_length': 3.9622093023255816, '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': '6386715', 'n_tokens_mistral': 551, 'n_tokens_neox': 542, 'n_words': 113}