example.raml
#%RAML 1.0
---
title: Test API
baseUri: http://192.168.0.100:8080/api/
version: v1
/helloworld:
get:
description: HelloWorld
responses:
200:
body:
application/json:
example: |
{
"code": "1100",
"msg": "操作成功",
"data": "Hello World!"
}
500:
body:
application/json:
example: |
{
"code": "1100",
"msg": "操作失败",
"data": null
}
构建 mock 服务:
npm i -g install osprey-mock-service
osprey-mock-service -f exampleApi.raml -p 8080
访问: localhost:8080/api/helloworld
本地运行api-designer:
npm install -g api-designer
api-designer