api-gateway-httpx
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

api-gateway-httpx

声明

为了适用Vue项目基于httpx做了一点修改。使用方式和httpx一致。 Httpx

Installation

$ npm install api-gateway-httpx --save

Usage

'use strict';
 
const httpx = require('api-gateway-httpx');
 
httpx.request('http://www.baidu.com/').then((response) => {
  response.pipe(process.stdout);
 
  response.on('end', () => {
    process.stdout.write('\n');
  });
}, (err) => {
  // on error
});

Or with co.

co(function* () {
  var response = yield httpx.request('http://www.baidu.com/');
 
  response.pipe(process.stdout);
 
  response.on('end', () => {
    process.stdout.write('\n');
  });
});

Or with async/await.

(async function () {
  var response = await httpx.request('http://www.baidu.com/');
 
  response.pipe(process.stdout);
 
  response.on('end', () => {
    process.stdout.write('\n');
  });
})();

Readme

Keywords

none

Package Sidebar

Install

npm i api-gateway-httpx

Weekly Downloads

2

Version

1.0.1

License

MIT

Unpacked Size

9.83 kB

Total Files

4

Last publish

Collaborators

  • wangjunzzz