0.0.2 • Published 6 years ago

swagger-vue-api-cli v0.0.2

Weekly downloads
9
License
-
Repository
github
Last release
6 years ago

Swagger Vue Api CLI

Swagger Vue Api CLI 是一个基于 Swagger 与 Vue 快速生成 api.js 的命令行工具。

该具受Easy Mock 与 Easy mock cli启发

Links

Installation

npm install -g swagger-vue-api-cli
# or
npm install --save swagger-vue-api-cli

如何使用

在vue项目根目录下新建一个 .swagger-api.js 文件

.swagger-api.js内容举例

module.exports = {

"host": "http://***",
"output": "./src/api",
"name": "url-list",
"template": "./template/axios"
"swaggerJSON": "http://***/swagger/v1/swagger.json"

}

host:要生成api的根地址
output:api输出地址
name:要创建的存放api列表的地方,默认为demo
template:自定义模版地址,不填则用默认模版
swaggerJSON:swagger json 地址

默认模版示例

swagger-api-template

配置完成后生成api

swaggerapi init