The starting point
The interface document helps you identify interface names, parameters, and types, improving development efficiency, and helping you view and determine the interface of a function in the future.
We were looking for a tool that would make it easy for the front end to view interface documentation and for the back end to automatically generate interface documentation. Discover that Swagger has this function. Here’s how Swagger is used, and how it compares to other tools.
Introduction of swagger
Introducing Springfox-Swagger in a back-end project can scan the relevant code to generate a description file, which in turn generates interface documentation and client code consistent with the code. This approach of generating interface documentation from code can be very efficient in later projects where the requirements are constantly iterated.
Swagger characteristics
L Automatically generate interface documentation (accessed through a browser) according to interface annotations.
L Online test interface.
How to use swagger in front
Visit the sample link: http://ip address: port number/project name /swagger-ui.html
L View the interface name
L View request Parameters in Parameters
L Check the return parameters in Example Value
L Test interface, input request parameters, click “Try it out!”
How to use swagger in back end
L Define interface names: use @apiOperation () and @requestMapping () annotations
Define request parameters: use the @requestBody @APIParam () annotation
L Define the return parameter: use the @responseBody annotation
Define the data model: use the @apiModel () annotation
How do different items access Swagger
Access path: http://ip Address: port number/project name /swagger-ui.html So multiple projects, there are multiple access paths.