This project is forbidden.
A simple api doc site for roadhog project.
- Support build static data
- Support write docs
- Support request editable
$ npm install roadhog-api-doc -g
# start api doc directly
$ cd [roadhog project]
$ roadhog-api-doc start
# start server with roadhog project server
$ cd [roadhog project]
$ roadhog-api-doc start [port] # your roadhog project server port
$ cd [roadhog project]
$ roadhog-api-doc build
In your dist
directory, you can see api.html
, api.js
, api.css
If you need to write doc, you can write mock data like this in .roadhogrc.mock.js
:
'GET /api/currentUser': {
$desc: "this is the api description",
$params: {
pageSize: 1,
page: {
desc: '分页',
exp: 2
},
},
$body: {
name: 'momo.zxy',
avatar: imgMap.user,
userid: '00000001',
notifyCount: 12,
}
},
You should add format
to wrapper .roadhogrc.mock.js
's export:
import { format } from 'roadhog-api-doc';
const mock = {...};
export default format(mock);
and you can use functional tool to enhance mock.
import { delay } from 'roadhog-api-doc';
const mock = {...};
export default delay(mock, 1000);
- Error: Module not found: Can't resolve 'babel' in '_roadhog-api-doc'
- try cnpm install your project dependencies.
- support [email protected]
- support roadhog 2.x
- support dynamic update post & get when
.roadhog.mock.js
refresh - support docs field
- upgrade Windows compatibility