swagger-vue
Swagger to JS & Vue & Axios Codegen
Installation
npm install swagger-vue --dev
Generate
Using NodeJS file
const swaggerGen = const jsonData = const fs = const path = let opt = swagger: jsonData moduleName: 'api' className: 'api'const codeResult = fs
Using Grunt task
Create Gruntfile.js
const fs = const path = const swaggerGen = module { grunt; grunt; grunt; };
And set options in package.json
... "swagger": ...
Now you can use grunt vue
to run build task
Generated client usage
In Vue.js main file set API domain
Import API function into Vue.js component, for example to log in
All requests use axios module with promise, for more information about that follow axios documentation