var express = require('express');
var glenlivet = require('glenlivet');
var app = express();

var prolific = glenlivet.createBarrel({
  plugins: [
    require('glenlivet-request'),
    require('glenlivet-htmltojson'),
    require('glenlivet-controller')
  ],
  pluginDefaults: {
    request: {
      protocol: 'http',
      host: 'www.prolificinteractive.com'
    }
  },
  bottleMethod: {
    returnDataPath: 'json'
  }
});

prolific.bottle('getLinks', function () {
  request: {
    pathname: function (data) {
      return '/' + (data.page || '');
    },
    header: {
      'Weird-Ass-Header': getWeirdAssHeader
    }
  },
  htmlToJson: ['a[href]', {
    'text': function ($a) {
      return $a.text();
    },
    'href': function ($a) {
      return $a.attr('href');
    }
  }]
});

app.use(function addResponseMethods (req, resp, next) {
  resp.success = function (data) {
    resp.send(data);
  };

  resp.error = function (err) {
    resp
    .status(err.status)
    .send({
      error: {
        type: err.type,
        message: err.message
      }
    });
  };

  next();
});

app.listen(process.env.PORT || 8888);

app.get('/:page/links', function (req, resp) {
  var page = req.param('page');

  prolific
    .getLinks({ page: page })
    .done(resp.success, resp.failure);
});

@@ -52,25 +52,24 @@
 equire('
-glenlivet
+../index
 ');%0Avar 
@@ -212,45 +212,8 @@
 on')
-,%0A    require('glenlivet-controller')
 %0A  %5D
@@ -325,58 +325,8 @@
   %7D%0A
-  %7D,%0A  bottleMethod: %7B%0A    returnDataPath: 'json'%0A
   %7D%0A
@@ -361,20 +361,8 @@
 ks',
- function ()
  %7B%0A 
@@ -447,73 +447,8 @@
 ');%0A
-    %7D,%0A    header: %7B%0A      'Weird-Ass-Header': getWeirdAssHeader%0A
     
@@ -724,16 +724,21 @@
 end(data
+.json
 );%0A  %7D;%0A
@@ -783,16 +783,18 @@
 esp%0A    
+  
 .status(
@@ -805,16 +805,18 @@
 status)%0A
+  
     .sen
@@ -825,16 +825,18 @@
 %7B%0A      
+  
 error: %7B
@@ -844,16 +844,18 @@
         
+ 
+ 
 type: er
@@ -862,16 +862,18 @@
 r.type,%0A
+  
         
@@ -899,18 +899,22 @@
 e%0A      
-%7D%0A
+  %7D%0A  
     %7D);%0A

Clean up example