auto-request
Version:
通过Yapi JSON Schema生成接口Axios或Taro接口
28 lines (24 loc) • 796 B
text/typescript
/**
* 开发模式测试 - usercenter
* 从源码导入
*/
import { autoRequest } from '@/index';
import path from 'path';
import usercenterApi from '@/../example/usercenter/swagger.json';
const { usercenterConfig, getConfig } = require('./../base/configs');
const generatorApi = (source, api, log, snapshots) => {
const config = getConfig(usercenterConfig, {
snapshotsPath: snapshots,
});
autoRequest(JSON.stringify(source) as any, api, config as any)
.then(({ write, template }: any) => {
write();
})
.catch((err) => console.log(err));
};
generatorApi(
usercenterApi,
path.join(__dirname, './../../example/usercenter/api/'),
path.join(__dirname, './../../example/usercenter/logs/'),
path.join(__dirname, './../../example/usercenter/snapshots.md')
);