0.0.28 • Published 5 months ago

@kevisual/query v0.0.28

Weekly downloads
-
License
ISC
Repository
github
Last release
5 months ago

query

对 fetch 功能的的一部分功能的封装。主要处理header的token的提交和response中的处理json。

主要目的:请求路径默认/api/router,使用post,post的数据分流使用pathkey.

适配后端的项目 @kevisual/router

query

const query = new Query();
const res = await query.post({
  path: 'demo',
  key: '1',
});

参数

type QueryOpts = {
  url?: string;
  adapter?: typeof adapter;
  headers?: Record<string, string>;
  timeout?: number;
};
type Data = {
  path?: string;
  key?: string;
  [key: string]: any;
};
// 额外功能
type DataOpts = Partial<QueryOpts> & {
  beforeRequest?: Fn;
};

适配的@kevisual/router的代码

import { App } from '@kevisual/router';
const app = new App();

app
  .route({
    path: 'demo',
    key: '1',
  })
  .define(async (ctx) => {
    ctx.body = 234;
  })
  .addTo(app);
0.0.19-beta.0

5 months ago

0.0.20

5 months ago

0.0.21

5 months ago

0.0.22

5 months ago

0.0.23

5 months ago

0.0.24

5 months ago

0.0.25

5 months ago

0.0.7-alpha.3

11 months ago

0.0.15

7 months ago

0.0.16

7 months ago

0.0.17

7 months ago

0.0.18

5 months ago

0.0.19

5 months ago

0.0.10

7 months ago

0.0.11

7 months ago

0.0.12

7 months ago

0.0.13

7 months ago

0.0.14

7 months ago

0.0.9-alpha.2

8 months ago

0.0.9-alpha.1

8 months ago

0.0.26

5 months ago

0.0.9

7 months ago

0.0.27

5 months ago

0.0.8

8 months ago

0.0.28

5 months ago

0.0.7

8 months ago

0.0.7-alpha.2

12 months ago

0.0.3

1 year ago

0.0.7-alpha.1

1 year ago

0.0.5

1 year ago

0.0.4

1 year ago

0.0.6

1 year ago

0.0.2-alpha.0

1 year ago

0.0.2

1 year ago

0.0.1

1 year ago