RESTFUL API文档生成工具及规范

文章目录
  1. 1. 1. Swagger
  2. 2. 1.1 Swagger UI
  3. 3. 1.2. swaggerize
  4. 4. 1.2.1 安装 swaggerize
  5. 5. 1.2.2 使用
  6. 6. 2. API Blueprint
  7. 7. 3. RAML

本文收集关于在Node.js项目中通过模型定义自动生成API接口文档的工具和方法

1. Swagger


1.1 Swagger UI

https://github.com/wordnik/swagger-ui

1.2. swaggerize

sequelize.js模型对象生成swagger模型定义

1.2.1 安装 swaggerize

1
npm install swaggerize

1.2.2 使用

1
var Sequelize = require('sequelize');
var swaggerize = require('swaggerize');
var sequelize = new Sequelize(config.database, config.username, config.password, config.options);
// 加载模型
// sequelize.import(UserModelFile);
sequelize.sync();
var swagger_model_json = swaggerize(sequelize);

2. API Blueprint

http://apiary.io/
https://github.com/wordnik/swagger-node-express/blob/master/Apps/petstore/models.js

3. RAML