amino-driver-http

HTTP driver for amino

npm install amino-driver-http
8 downloads in the last week
8 downloads in the last month

amino-request-http allows you to use HTTP as a transport for amino requests.

**note: this driver must be used in conjunction with a pub/sub driver. See amino-pubsub-redis as an example.

Usage

serve-sprocket.js

// Create a sprocket service.
var amino = require('amino')
  .use(require('amino-request-http'))
  .use(require('amino-pubsub-redis'), {host: 'localhost', port: 6379});

amino.respond('sprockets', function(router, spec) {
  // router is a director router.
  // @see https://github.com/flatiron/director
  router.get('/:id', function(id) {
    // amino adds the helpers json(), text(), and html().
    this.res.json({id: id});
  });
});

get-sprocket.js

// Request a sprocket from the sprocket service.
var amino = require('amino')
  .use(require('amino-request-http'))
  .use(require('amino-pubsub-redis'), {host: 'localhost', port: 6379});

// amino.request() is the same as github.com/mikeal/request, except
// it can handle the amino:// protocol, which uses virtual hosts defined
// with amino.respond().
amino.request('amino://sprockets/af920c').pipe(process.stdout);
npm loves you