hook.io-restful

RESTful interface for hook's, provides a RESTful web server for surfaced hooks

A hook to surface chosen hooks to the rest of the world via a RESTful interface. Hooks choose to register and provide documentation details.

{
  port: 8080
}

This hook is very much under construction with many things changing, but wanted to get it up for feedback.

RESTfulReady Notify's RESTfulHook's that a RESTfulServer is available to serve requests.

 
/* helloWorldHook.js */
 
var RESTfulHook = require('../../lib/restful').RESTfulHook,
    util        = require('util');
 
var helloWorldHook = exports.helloWorldHook = function(options){
  var self = this;
  RESTfulHook.call(self, options);
  self.exports(self._hello);
  self.exports(self.sayHello);
};
util.inherits(helloWorldHook, RESTfulHook);
 
helloWorldHook.prototype._hello = function(ssiddetails){
  if(details.query&&details.query.name) myHook.sendResponse(ssid, 'Hello '+details.query.name+'!');
  else myHook.sendResponse(ssid, 'Hello World!');
};
helloWorldHook.prototype._hello.description = 'Returns Hello World! if no name is specified or Hello <Name>! if name is specified.';
helloWorldHook.prototype._hello.schema = {
  name: {
    required: false,
    validation: 'string',
    description: 'The name to return in place of World.',
  }
};
helloWorldHook.prototype._hello.route = 'hello';
 
helloWorldHook.prototype.sayHello = function(ssiddetails){
  if(details.query&&details.query.name) myHook.sendResponse(ssid, 'Hello '+details.query.name+' 2!');
  else myHook.sendResponse(ssid, 'Hello World 2!');
};
helloWorldHook.prototype.sayHello.description = 'Returns Hello World! if no name is specified or Hello <Name>! if name is specified.';
helloWorldHook.prototype.sayHello.schema = {
  name: {
    required: false,
    validation: 'string',
    description: 'The name to return in place of World.',
  }
};
 
 
/* helloWorld.js */
/* This is basically a way to instanciate the helloWorldHook without using .spawn */
 
#!/usr/bin/env node
 
var Helloworld = require('./helloWorldHook').helloWorldHook;
var myHook = new Helloworld();
 
myHook.start();