当前位置:网站首页>Swagger UI tutorial API document artifact
Swagger UI tutorial API document artifact
2022-07-06 20:56:00 【51CTO】
Catalog
[TOC]
Preface
In some interface projects ,API Is used frequently , So a API Online document generation and testing tools are essential . and Swagger UI It's such a practical online tool
This blog describes how to follow the Swagger UI, Note that the company's test server is Linux Systematic , Therefore, this blog only introduces based on Linux Systematic Swagger Environment building process
Server environment installation ##
NodeJS Download deployment ###
First you need to download NodeJS, To nodejs Official website http://nodejs.org/dist/v0.10.26, download node-v0.10.26-linux-x64.tar.gz, Because this is already compiled , So we first use software to upload files to Linux The server , have access to WinSCP
And then use Linux Of cd The command comes to you nodejs Location of compressed files
The decompression command is as follows :
And then go to the file
perform
Set up node overall situation
Set up npm overall situation
testing nodejs and npm Is the installation successful
You can see the version number , What installation succeeded
express Download deployment ####
Install well NodeJS and NPM after , We can install it express 了
The following important modules are needed with express The frame is installed together :
body-parser - node.js middleware , Used for processing JSON, Raw, Text and URL Encoded data .
cookie-parser - This is an analysis Cookie Tools for . adopt req.cookies You can take it from cookie, And turn them into objects .
multer - node.js middleware , Used for processing enctype="multipart/form-data"( Set the MIME code ) Form data for .
Check whether the installation is successful
NodeJS Boot up ####
Then set the NodeJS Boot up
install forever
Set up
Swagger UI Installation and deployment ##
github On clone: https://github.com/swagger-api/swagger-ui If there is a download Git, Just use git download , Get access to github, Direct download
Then, according to the needs of the company , stay Linux On mkdir, I was there first root route , Create a node_app file
Get into node_app
Environment configuration
The following tips can be filled in according to your own needs
VI Editor use :
Add code
Enable server
visit , Input http:// Company servers IP:3000
You can see Helloworld, Of course, we need to deploy Swagger
stay node_app So let's create one public Folder
Then download to swagger ui Inside dist Copy the files in the folder to public Folder
modify index.js
Then input http://ip:3000/swapper, Yes, you can see something similar page
Picture description here
Swagger Editor Use ##
Swagger Editor yes Swagger UI The online editor , We can build our own , You can also use the official , The official URL: http://editor.swagger.io/#/
github On Clone: https://github.com/swagger-api/swagger-editor After the swagger editor Put the document in the company Linux Server
Http server install ###
Start the project http-server swagger-editor, The default is 8080 port
Set up port And start the swagger editor
Input http://ip:2017/#/ You can access your own Swagger Editor Editor
Reference tutorial
http://www.linuxidc.com/Linux/2014-07/104489.htm
http://www.linuxidc.com/Linux/2014-06/103372.htm
边栏推荐
- Common doubts about the introduction of APS by enterprises
- 小孩子學什麼編程?
- 2110 summary of knowledge points and common problems in redis class
- Event center parameter transfer, peer component value transfer method, brother component value transfer
- Laravel笔记-自定义登录中新增登录5次失败锁账户功能(提高系统安全性)
- 电子游戏的核心原理
- (work record) March 11, 2020 to March 15, 2021
- 使用.Net分析.Net达人挑战赛参与情况
- Reinforcement learning - learning notes 5 | alphago
- What key progress has been made in deep learning in 2021?
猜你喜欢
【微信小程序】运行机制和更新机制
[weekly pit] positive integer factorization prime factor + [solution] calculate the sum of prime numbers within 100
Database - how to get familiar with hundreds of tables of the project -navicat these unique skills, have you got it? (exclusive experience)
Gui Gui programming (XIII) - event handling
Implementation of packaging video into MP4 format and storing it in TF Card
[DSP] [Part 1] start DSP learning
看过很多教程,却依然写不好一个程序,怎么破?
OAI 5g nr+usrp b210 installation and construction
Spark SQL chasing Wife Series (initial understanding)
【mysql】触发器
随机推荐
OLED屏幕的使用
No Yum source to install SPuG monitoring
Common doubts about the introduction of APS by enterprises
Comment faire une radio personnalisée
知识图谱之实体对齐二
Review questions of anatomy and physiology · VIII blood system
Laravel notes - add the function of locking accounts after 5 login failures in user-defined login (improve system security)
Intel 48 core new Xeon run point exposure: unexpected results against AMD zen3 in 3D cache
New database, multidimensional table platform inventory note, flowus, airtable, seatable, Vig table Vika, Feishu multidimensional table, heipayun, Zhixin information, YuQue
Spiral square PTA
R language visualizes the relationship between more than two classification (category) variables, uses mosaic function in VCD package to create mosaic plots, and visualizes the relationship between tw
Taylor series fast Fourier transform (FFT)
过程化sql在定义变量上与c语言中的变量定义有什么区别
Rhcsa Road
监控界的最强王者,没有之一!
In line elements are transformed into block level elements, and display transformation and implicit transformation
拼多多败诉,砍价始终差0.9%一案宣判;微信内测同一手机号可注册两个账号功能;2022年度菲尔兹奖公布|极客头条
Solution to the 38th weekly match of acwing
Infrared thermometer based on STM32 single chip microcomputer (with face detection)
15 millions d'employés sont faciles à gérer et la base de données native du cloud gaussdb rend le Bureau des RH plus efficace