1.0.1 • Published 7 years ago

autorun-apidoc v1.0.1

Weekly downloads
2
License
-
Repository
github
Last release
7 years ago

autorun-apidoc

Installation

$ npm install git+https://github.com/hfrely/autorun-apidoc.git
$ sudo npm install -g apidoc

Example of use

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);

Docs

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