sugo-agent-base

1.2.12 • Public • Published

sugo-agent-base

Build Status npm Version JS Standard

Base class of HTTP clients for SUGOS

Installation

$ npm install sugo-agent-base --save

Usage

'use strict'
 
const { SugoAgentBase } = require('sugo-agent-base')
const co = require('co')
 
class YourCustomAgent extends SugoAgentBase() {
  constructor (url, options = {}) {
    super(url, options)
    /* ... */
  }
 
  doSomething (/* ... */) {
    const s = this
    let { request, url } = s
    return co(function * () {
      let { statusCode, body } = request.post(`${url}/hoge`, {
        data: {}
      })
      /* ... */
    })
  }
}
 
let agent = new YourCustomAgent()
/* ... */
 

License

This software is released under the MIT License.

Links

Readme

Keywords

Package Sidebar

Install

npm i sugo-agent-base

Weekly Downloads

0

Version

1.2.12

License

MIT

Last publish

Collaborators

  • realglobe