mohsen1/swagger-docs

语言: JavaScript

git: https://github.com/mohsen1/swagger-docs

Swagger API文档查看器 - 演示 - >
Swagger API Documentations Viewer - A demo -->
README.md (中文)

Swagger Docs

Swagger API文档查看器

Build Status

警告!正在开发中

该项目正在开发中,尚未准备好用于生产。

特征

✔可定制

定制Swagger Docs的外观非常容易。

✔可链接

每个路径,操作,参数和更多元素都有自己的URL。

✔独立于Swagger规格

Swagger Docs可以动态加载Swagger规范。更新您的API文档就像更新Swagger规范文件(swagger.json)一样简单。

✔模板

您可以在描述部分或其他位置使用模板为每个用户提供自定义变量。例如,您可以在文档中使用user_token。

✔移动就绪

文档在移动设备中看起来很好。

用法

提供静态文件

Swagger Docs是一个静态Web应用程序。您可以通过npm下载并提供服务 您的Web服务器中的dist文件夹。 Swagger Docs将向./swagger.json提出请求 获取要呈现的Swagger文档。

npm install swagger-docs

使用Connect中间件

如果您使用Express或任何其他基于Connect的服务器,则有一个连接中间件。

var SwaggerDocs = require('swagger-docs');
var swagger = require('path/to/swagger.json');

app.use(SwaggerDocs.middleWare(swagger, {path: '/api-documentations'}));

配置Swagger文档

在此处阅读配置文档

发展

阅读开发文档。

执照

WITH

本文使用googletrans自动翻译,仅供参考, 原文来自github.com

en_README.md

Swagger Docs

Swagger API Documentations Viewer

Build Status

Warning! Under development

This project is under development and not ready for production use.

Features

✔ Customizable

It's very easy to customize the looks of Swagger Docs.

✔ Linkable

Each path, operation, parameter and many more elements have their own URL.

✔ Independent from Swagger specs

Swagger Docs can load Swagger specs dynamically. Updating your API documentation is as easy as updating your Swagger specs file (swagger.json).

✔ Templates

You can use templates in description sections or other places to have custom variables for each user. For example you can have user access_token in documentations.

✔ Mobile Ready

Documentations look as good in mobile devices.

Usage

Serve static files

Swagger Docs is a static web application. You can download it via npm and serve
the dist folder in your web server. Swagger Docs will make a request to ./swagger.json
to get the Swagger document to render.

npm install swagger-docs

Use the Connect middle-ware

If you are using Express or any other Connect based server, there is a connect middle-ware.

var SwaggerDocs = require('swagger-docs');
var swagger = require('path/to/swagger.json');

app.use(SwaggerDocs.middleWare(swagger, {path: '/api-documentations'}));

Configuring Swagger Docs

Read Configuration Documentations here

Development

Read Development Documentations here.

License

MIT