koa-resourcer-docs
Introduction
A simple documentation generator for koa-resourcer.
App resources that have exposed routes will be parsed and documented.
Use
In your app:
var koa = ;var join = join;var resource = ;var docs = ; var app = ;;app;
In each resource app:
var koa = ;var Router = ; var router = ;var app = moduleexports = ; // Expose routes to documentation generatorapproutes = routerroutes; // Define some routes... app;
Configuration
Add a description to the route config:
router;
Hide a resource by not exposing routes:
// Expose routes to documentation generator//app.routes = router.routes;
Hide individual routes in a resource app from documentation by adding hide: true
to route metadata:
// Documented route:router; // Hidden route:router;
Add middleware to intercept requests before routing to docs:
var docs = ; // Respond with 404 if not in a development environmentdocs;
For backwards compatibility "hide" and "description" on the koa-joi-router configuration object are still supported but no longer recommended since they pollute the namespace of the configuration.
Installation
npm install koa-resourcer-docs --save