$ npm install git+https://github.com/hfrely/autorun-apidoc.git
$ sudo npm install -g apidoc
const express = require('express');
const AutorunApidoc = require('autorun-apidoc');
AutorunApidoc.port(4000); // Default: 3030
AutorunApidoc.dirname('/Users/hfrely/api/apidoc/'); // Default: yourProject/../apidoc
AutorunApidoc.run(); // Run apidoc: http://localhost:4000
let app = express();
/**
* @api {get} / get OK
* @apiName getOk
* @apiGroup GET
*
* @apiSuccessExample {json} OK
* HTTP/1.1 200 OK
* {
* "test": "OK"
* }
*
*/
app.get('/', (req, res) => {
res.json({test: 'OK'});
});
app.listen(3000);
AutorunApidoc.port(4000)
: Use this function to choose your port. Default port 3030
AutorunApidoc.dirname('/Users/hfrely/api/apidoc/')
: Use this function to choose your folder for apidoc. Default folder yourProject/../apidoc
AutorunApidoc.run()
: Run your apidoc