lite-ts-rpc
TypeScript icon, indicating that this package has built-in type declarations

11.27.7 • Public • Published

Version

代码

RpcBase - 远程调用

const rpc: RpcBase;
const mockResp: RpcResponse<T>;
const resp = await rpc.call<T>({
    body: {}, // 请求内容
    header: {}, // 请求头
    isThrow: true, // 默认false 当为true时 如果返回结果的错误码不为0 则直接抛错
    mock: mockResp, // 当该字段有效时 请求直接返回该值
    route: '路由',
});
// resp = { err: 错误码, data: T }
  • QueueRpc - 队列请求调用
const rpc: RpcBase;
const rpc = new QueueRpc(rpc);

RpcEndpoint - 端

说明
backendHttp bh 后台http
interalHttp ih 内部http
mobileHttp mh 手机http
openHttp oh 开放http
webSocket ws WebSocket

RpcHeader - 请求头

说明
h-a-d 认证数据
h-a-t 认证令牌
h-e 环境
h-t 超时

Readme

Keywords

Package Sidebar

Install

npm i lite-ts-rpc

Weekly Downloads

26

Version

11.27.7

License

GPL-3.0

Unpacked Size

45.2 kB

Total Files

22

Last publish

Collaborators

  • ahl5esoft