nocobase/examples/api-client/api.request.ts
chenos 28b73d7143
feat: add examples (#718)
* feat: add examples

* fix: tsconfig-paths/register

* feat: more examples

* fix: test errors

* feat: update examples

* docs: example list

* fix: updates

* feat: example for test case

* feat: api client

* fix: updates

* feat: tree structures

* fix: adjacency-list
2022-08-16 14:41:29 +08:00

26 lines
506 B
TypeScript

/*
# 客户端常规请求
# 步骤
Step 1: 启动服务器
yarn run:example api-client/server start
Step 2: 客户端常规请求 —— api.request()
yarn run:example api-client/api.request
*/
import { APIClient } from '@nocobase/sdk';
const api = new APIClient({
baseURL: 'http://localhost:13000/api',
});
(async () => {
const response = await api.request({
url: 'test:list',
});
// 等价于
// const response = await api.resource('test').list();
console.log(response.data);
})();