In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly explains "the steps of integrating apidoc with springboot". Interested friends may wish to have a look at it. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn the steps of integrating apidoc with springboot.
A brief introduction to apidoc
Apidoc generates api documentation by commenting on your code. It is not intrusive to the code, as long as you write the relevant comments, and it can generate a good-looking api interface page by writing a simple configuration. It is based on node.js, so you need to install the node.js environment. To install node.js, click here. There is no introduction here.
II. Preparatory work
After installing node.js, install api.doc, its project source code: https://github.com/apidoc/apidoc.
Install through the command:
Npm install apidoc-g
3. How to write the notes
@ api
@ api {method} path [title] method: request method, path: request path title (optional): title
@ apiDescription
@ apiDescription texttext description
@ apiError
@ apiError [(group)] [{type}] field [description] (group) (optional): parameter will be grouped by this name. If not set, default is Error 4xx {type} (optional): return value type, for example: {Boolean}, {Number}, {String}, {Object}, {String []} field: return value field name descriptionoptional (optional): return value field description
@ apiGroup
@ apiGroup namename: group name, which is also the title of the navigation
For more comments, see the official documentation: http://apidocjs.com/#params
4. Write the configuration file for Chestnut first
Create a new apidoc.json file in the home directory of the project:
{"name": "example", "version": "0.1.0", "description": "A basic apiDoc example"}
More configuration reference: http://apidocjs.com/#configuration
Write a note: / * * @ api {POST} / register registered user * @ apiGroup Users * @ apiVersion 0.0.1 * @ apiDescription for registered user * @ apiParam {String} account user account name * @ apiParam {String} password password * @ apiParam {String} mobile Mobile number * @ apiParam {int} vip = 0 whether to register Vip Identity 0 ordinary user 1 Vip user * @ apiParam {String} [recommend] invitation code * @ apiParamExample {json} request sample: *? account=sodlinken&password=11223344&mobile=13739554137&vip=0&recommend= * @ apiSuccess {String} msg message * @ apiSuccess {int} code 0 represents no error 1 represents error * @ apiSuccessExample {json} Return sample: * {"code": "0" "msg": "registered successfully"} * / generate the document interface with the apidoc command
First cd to the outer directory of the project, and build a directory of output documents in the outer layer. I built docapi.
Enter the command:
Apidoc-I chapter4/-o apidoc/
-I input directory-o output directory
Chapter4 is my project name.
You can see that many files are generated in the apidoc directory:
Open index.html and you can see the document page:
At this point, I believe that you have a deeper understanding of the "springboot integration apidoc steps", might as well come to the actual operation of it! Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.