ahr

Abstract HTTP Request ===

npm install ahr
2 downloads in the last week
86 downloads in the last month

Abstract HTTP Request

AHR is a middleware framework for http clients (Browser and NodeJS).

Think connect, but for clients.

API

  • AHR.create()
  • AHR#http()
    • request
    • response
  • AHR#use()
  • AHR#extend()

Example

var ahr = require('ahr')
  , client
  , request
  ;

client = ahr.create()
  .extend(ahr.Http())
  .use(ahr.json())
  ;

req = client.get("http://foobar3000.com/echo/example.json");
req.on('complete', function (data) {
});

req.on('progress', function () {
  // whatever
});
req.on('data', function () {
  // whatever
});
req.on('end', function () {
  // whatever
});
req.on('response', function (res) {
  res.on('progress', function () {
    // whatever
  });
  res.on('data', function () {
    // whatever
  });
  res.on('end', function () {
    // whatever
  });
});
npm loves you