0.2.2 • Published 3 years ago

nuxt-swaggerjsonapi v0.2.2

Weekly downloads
74
License
MIT
Repository
-
Last release
3 years ago

title: "Introduction" description: "The nuxt-swaggerjsonapi module for Nuxt" position: 1 category: "" menuTitle: "Introduction" features:

  • Automatically add API to application
  • Quickly copy API method and data to page, component, layout, vuex and Middleware
  • Friendly @nuxtjs/axios integration
  • Provide address generation swagger.json And Provide local swagger.json File path

Setup

Add nuxt-swaggerjsonapi dependency to your project

npm install nuxt-swaggerjsonapi
or
yarn add nuxt-swaggerjsonapi

Recommended use @nuxtjs/axios

yarn add @nuxtjs/axios

Then add it to the modules section in your nuxt.config.js

export default {
  modules: ["@nuxtjs/axios", "nuxt-swaggerjsonapi"],
  plugins: ["~plugins/api"],
};

Configure

const path = require("path");
export default {
  modules: ["@nuxtjs/axios", "nuxt-swaggerjsonapi"],
  plugins: ["~plugins/api"],

  swaggerJsonApi: {
    // Address generation and local generation
    /*
     ** SourcePath: path.resolve(__dirname, "swagger.json"),
     ** OR
     ** FileUrl: "http://localhost:8080/swagger.json",
     */
    SourcePath: path.resolve(__dirname, "swagger.json"),
    OutputPath: path.resolve(__dirname, "./plugins/api/api.js"),
    Model: "details",
  },
};
  • Sourcepath: Swagger.json route
  • OutputPath: Api.js route

Development environment api.js And formal environment api.js The difference between

Model: "" (default)

// getUserInfo

Model: "details"

/* 
** Interface name: getUserInfo
** Parameter structure: 
**    {"name":"AuthToken","in":"header","description":"Token info"}
** methods: The entire API call (Directly copy, paste, remove the notes can be used directly): 
    GetUserCloudAccount(){ 
      let params = { 
      } 
      this.$api.Account.GetUserCloudAccount(params).then(res => { 
      }) 
    }, 
** data(Vue use): 
    GetUserCloudAccountParams: { 
    } 
*/

Author

LICENSE

MIT

0.2.1

3 years ago

0.1.2

3 years ago

0.2.0

3 years ago

0.1.8

3 years ago

0.1.7

3 years ago

0.1.9

3 years ago

0.1.4

3 years ago

0.2.2

3 years ago

0.1.3

3 years ago

0.1.6

3 years ago

0.1.5

3 years ago

0.1.1

3 years ago

0.1.0

3 years ago

0.0.24

3 years ago

0.0.25

3 years ago

0.0.26

3 years ago

0.0.23

3 years ago

0.0.22

3 years ago

0.0.20

3 years ago

0.0.21

3 years ago

0.0.16

3 years ago

0.0.17

3 years ago

0.0.18

3 years ago

0.0.19

3 years ago

0.0.15

3 years ago

0.0.14

3 years ago

0.0.12

3 years ago

0.0.13

3 years ago

0.0.11

3 years ago

0.0.10

3 years ago

0.0.9

3 years ago

0.0.8

3 years ago

0.0.7

3 years ago

0.0.6

3 years ago

0.0.5

3 years ago

0.0.4

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago