0.0.9 • Published 4 years ago

@tick-core/http-client v0.0.9

Weekly downloads
-
License
ISC
Repository
-
Last release
4 years ago

tick-core-http-client: http client

下载

npm install @tick-core/http-client

创建连接

const hostConfig = {
  test: 'host:port'
}

const httpClient = new HttpClient(hostConfig)
const testClient = httpClient.getClient('test')

OR

使用:@tick-core-zconf

import {
  Zconf,
} from '@tick-core/zconf'

const zconf = new Zconf({ conf: { test: '/app/test', }, zookeeperConfs: { host: '127.0.0.1', port: 2181, }, })

const httpClient = new HttpClient(zconf) const testClient = httpClient.getClient('test')

## 使用
```lua
testClient.post({
  url: '/test/12',
  body: {
    a: 12,
  }
}).then(result => {
  console.log(result)
}).catch(error => {
  console.log(error)
})

testClient.get({
  url: '/test/12',
  qs: {
    d: 15,
  }
}).then(result => {
  console.log(result)
}).catch(error => {
  console.log(error)
})

参考:@blued-core/http-client,该client集成了qconf。

0.0.9

4 years ago

0.0.8

4 years ago

0.0.7

4 years ago

0.0.5

4 years ago

0.0.6

4 years ago

0.0.4

4 years ago

0.0.3

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago