{"size": 1723, "ext": "js", "max_stars_repo_path": "src/catalog/client/route.js", "max_stars_repo_name": "Cart-API/cart", "max_stars_repo_stars_event_min_datetime": "2016-03-24T20:49:49.000Z", "max_stars_repo_stars_event_max_datetime": "2017-07-01T06:22:32.000Z", "max_issues_repo_path": "src/catalog/client/route.js", "max_issues_repo_name": "Cart-API/cart", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/catalog/client/route.js", "max_forks_repo_name": "Cart-API/cart", "max_forks_repo_forks_event_min_datetime": "2016-03-25T20:28:15.000Z", "max_forks_repo_forks_event_max_datetime": "2020-05-06T15:59:13.000Z"}
{"max_stars_count": 5, "max_issues_count": null, "max_forks_count": 4, "avg_line_length": 22.3766233766, "max_line_length": 68, "alphanum_fraction": 0.5310504933}
'use strict';

const Controller = require('./controller');
const Validator = require('./validation');

exports.register = (server, options, next) => {
  // instantiate controller
  const controller = new Controller(server.database);

  server.bind(controller);
  server.route([
    {
      method: 'GET',
      path: '/client',
      config: {
        description: 'GET clients',
        notes: 'Returns a clients',
        tags: ['api'],
        handler: controller.list,
        validate: Validator.list()
      }
    },
    {
      method: 'GET',
      path: '/client/{id}',
      config: {
        description: 'GET client',
        notes: 'Returns a client item by the id passed in the path',
        tags: ['api'],
        handler: controller.read,
        validate: Validator.read()
      }
    },
    {
      method: 'POST',
      path: '/client',
      config: {
        description: 'POST client',
        notes: 'Save a client',
        tags: ['api'],
        handler: controller.create,
        validate: Validator.create()
      }
    },
    {
      method: 'PUT',
      path: '/client/{id}',
      config: {
        description: 'PUT client',
        notes: 'Update a client item by the id passed in the path',
        tags: ['api'],
        handler: controller.update,
        validate: Validator.update()
      }
    },
    {
      method: 'DELETE',
      path: '/client/{id?}',
      config: {
        description: 'DELETE client',
        notes: 'DELETE a client item by the id passed in the path',
        tags: ['api'],
        handler: controller.destroy,
        validate: Validator.destroy()
      }
    }
  ]);

  next();
};

exports.register.attributes = {
  name: 'client',
  version: '1.0.0'
};

