'use strict';

/**
 * Module dependencies.
 */
var hostNamesPolicy = require('../policies/hostNames.server.policy'),
  hostNames = require('../controllers/hostNames.server.controller');

module.exports = function (app) {
  // HostNames collection routes
  app.route('/api/hostNames').all(hostNamesPolicy.isAllowed)
    .get(hostNames.list)
    .post(hostNames.create);

  // Single hostName routes
  app.route('/api/hostNames/:hostNameId').all(hostNamesPolicy.isAllowed)
    .get(hostNames.read)
    .put(hostNames.update)
    .delete(hostNames.delete);

  // Finish by binding the hostName middleware
  app.param('hostNameId', hostNames.hostNameByID);
};
