Skip to content

WangJunZzz/api-gateway-httpx

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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');
  });
})();

About

修改httpx包

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published