old_contents: 'use strict';
  const Pf = require(__dirname + '/../model/pf');
  
  // const Hapi = require('hapi');
  
  module.exports = [
    // Add the route
    {
      method: 'GET',
      path: '/hello',
      handler: function(request, reply) {
        return reply('hello world\n');
      }
    },
    // add second route
    {
      method: 'GET',
      path: '/{name}',
      handler: function(request, reply) {
        reply('Hello, ' + encodeURIComponent(request.params.name) + '!\n');
      }
    },
    // Delete
    {
      method: 'DELETE',
      path: '/{name}',
      handler: function(request, reply) {
        reply('goodbye, ' + encodeURIComponent(request.params.name) + '!\n');
      }
    },
    // API Routes
    {
      method: 'GET',
      path: '/api/pf',
      handler: function(request, reply) {
        Pf.find({}, (err, data) => {
        if (err) {
          console.log(err);
          return reply('Error on Get!');
        }
  
        return reply({
          statusCode: 200,
          message: 'Here are all the family members',
          data: data
          });
        });
      }
    },
    {
      method: ['PUT', 'POST'],
      path: '/api/put',
      handler: function(request, reply) {
        var newPf = new Pf(request.payload);
        newPf.save((err, data) => {
          if (err) {
            console.log(err);
            return reply('Error on Post/Put!');
          }
          reply(request.payload.name + ' added to the family!\n');
        });
      }
    },
    {
      method: 'DELETE',
      path: '/api/delete/{id}',
      handler: function(request, reply) {
        Pf.remove({ _id: request.params.id }, (err) => {
          if (err) {
            console.log(err);
            return reply('Error on delete!');
          }
          reply('Deleted!');
        });
      }
    }
  ];
  
new_contents: 'use strict';
  const Pf = require(__dirname + '/../model/pf');
  
  
  module.exports = [{
    method: 'GET',
    path: '/api/pf',
    handler: function(request, reply) {
      Pf.find({}, (err, data) => {
        if (err) {
          console.log(err);
          return reply('Error on Get!');
        }
        return reply({
          statusCode: 200,
          message: 'Here are all the family members',
          data: data
        });
      });
    }
  }, {
    method: 'POST',
    path: '/api/put',
    handler: function(request, reply) {
      var newPf = new Pf(request.payload);
      newPf.save((err, data) => {
        if (err) {
          console.log(err);
          return reply('Error on Post/Put!');
        }
        reply(request.payload.name + ' added to the family!\n');
      });
    }
  }, {
    method: 'PUT',
    path: '/api/put/{pfId}',
    handler: function(request, reply) {
      console.log(request.params.pfId);
      Pf.findOne({
        "_id": request.params.pfId
      }, (err, member) => {
        if (!err) {
          console.log(member);
          member = request.payload;
          Pf.update({
            _id: request.params.pfId
          }, member, (err) => {
            if (!err) {
              reply(request.payload.name + ' stays in the family for another season!\n');
            } else {
              return reply('The contract says we can\'t change that!');
            }
          })
        } else {
          reply.status(500);
        }
      })
    }
  }, {
    method: 'DELETE',
    path: '/api/delete/{id}',
    handler: function(request, reply) {
      Pf.remove({
        _id: request.params.id
      }, (err) => {
        if (err) {
          console.log(err);
          return reply('Error on delete!');
        }
        reply('Deleted!');
      });
    }
  }];
  
subject: PUT route works. committing so that doesn't get lost