RESTful API Style contract designer: Applications for Swagger-editor and Swagger-ui

Source: Internet
Author: User

Installation of Swagger-editor
    The YAML syntax applied by the
    • swagger-editor, with defined variables and data structures, does not understand that it is possible to refer to its example
    • installation steps:
      • download swagger-editor git address
      • shipping Line NPM Run build generates a running package
        • Window considerations:

        • Remove the Prebuild function from the Scripts node in the Package.json file, or you will be prompted RM-RF dist/** is not valid, it is clear that this is the file to delete the generated package, you can delete it manually or change the command yourself.

        • Changes the. eslintrc.js file, primarily to fix the authentication method for Linebreak-style

           module.exports =  {extends:  ' google '  ", Globals: {swaggereditor:  false   true  }, rules:{"
              /span> "Linebreak-style": ["Error", "Windows"  
    • Added the rules node, the above is the. Eslintrc.js Complete Configuration

    • You .\node_modules\.bin\http-server can open the input and then access port 8080 on this server.

Installation of Swagger-ui
    • Displays the API documentation generated by the Swagger-editor, which can be in YAML or JSON format.
    • Installation steps:
      • Download Swagger-ui git address
      • Two methods of deployment:
        • The first type: You can directly copy the contents of the Dist folder to a site directory or create a new site, there is a default swagger-ui default skin.
        • The second type:
          • Run CNPM install all dependent packages
          • Run Gulp serve
          • Access native port 8080, if there are multiple http-server, need to customize Http-server port, implement in Gulpfile.js file
function () {  connect.server ({    ' dist ',    true,    port:8888  });});
    • You can add print functionality for exporting API documents in PDF format. Easy circulation.

RESTful API Style contract designer: Applications for Swagger-editor and Swagger-ui

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.