middleagent
HTTP client for Node.js with Koa-like middleware interface
Last updated 3 years ago by pm5 .
MIT · Repository · Bugs · Original npm · Tarball
$ cnpm install middleagent 
SYNC missed versions from official npm registry.

Middleagent

HTTP client for Node.js with Koa-like middleware interface

Usage

Currently this is just a simple wrapper of Node.js http module with Koa-like middleware API and ES6 Promise:

var agent = require('middleagent')

agent.use(function * (next) {
  // do something with this.request in the cascading
  yield next
  // do something with this.response in the cascading
}).get('http://example.com', function * () {
  // do something in the cascading
}).then(function (context) {
  // do something
}, function (err) {
  // handle errors
})

License

MIT license

Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 2
Dependencies (1)
  • co ^4.5.1
Dev Dependencies (3)
Dependents (0)
None

Copyright 2014 - 2017 © taobao.org |