README
apidoc-plugin-bic-ws
Only a simple websocket plugin for apidoc. you can make websocket request directly at document pages generated by apidoc and this plugin to test your interface.
apidoc search in global node modules dir and local node_modules
for modules that start with apidoc-plugin-
. (local installed plugins have higher priority)
With a plugin you can add features like new parsers or filters and workers.
A plugin can use apidoc-core hooks. Hooks can be used to extend or transform data.
Install
npm install apidoc-plugin-bic-ws --save-dev
support new tag
@apiWebsocket arg
Permited value for arg is one of:
- boolean
- {cmd:func} url
- {cmd:func}
- url
Example Use
method level settings
Add the tag apiWebsocket
to your source file indicating turn on websocket request and parse cmd:func from url @api {get} /user/getName
,need global settings support.
/**
* @api {get} /user/getName getName
* @apiWebsocket true
*/
or custom server address
/**
* @apiWebsocket ws://localhost:8082
*/
or custom cmd func,need global settings support.
/**
* @apiWebsocket user:getName
*/
or custom all
/**
* @apiWebsocket user:getName ws://localhost:8082
*/
global settings
you can turn on the websocket request for all interfaces by adding a single line to apidoc.json
:
"wsRequest": "ws://localhost:8082"
just as the way as sampleUrl
; this config url apply by plugin unless you turn off at method level using:
/**
* @apiWebsocket false
*/
apidoc
like this:
after configuration, run apidoc -i example -t ./node_modules/apidoc-plugin-bic-ws/template
enhance api tag
@api {websocket} cmd:func your_api_title
or
@api cmd:func your_api_title
or maybe, your app support both http and websocket
@api {get,websocket} /cmd/func your_api_title
Note
- this plugin work with the
handlebars
template,so have to run with-t
opation. - all changes powered by apidoc
worker
andparser
extension,see parser and worker directory for detail.