auto-request
Version:
通过Yapi JSON Schema生成接口Axios或Taro接口
25 lines (21 loc) • 676 B
JavaScript
/**
* 构建模式测试 - all-api
* 从构建产物导入
*/
const { autoRequest } = require('./../../dist/bundle');
const path = require('path');
const allApi = require('./../../example/all-api/swagger.json');
const { allApiConfig, getConfig } = require('./../base/configs');
const generatorApi = (source, api, log) => {
const config = getConfig(allApiConfig, {
loggerPath: log,
});
autoRequest(JSON.stringify(source), api, config).then(({ write, json }) => {
write();
});
};
generatorApi(
allApi,
path.join(__dirname, './../../example/all-api/api/'),
path.join(__dirname, './../../example/all-api/logs/all-api.json') // 使用完整路径
);