A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/a-s-o/koa-docs below:

a-s-o/koa-docs: An automatic documentation generator for koa.js APIs

An automatic documentation generator for koa APIs. The goal is to make documentation easy using route specs that may already exist.

See example folder for source code. View example output

> npm install --save koa-docs@2.x.x

Note version 2.x.x of this package uses joi router version ^3 specs; use version 1.x.x of this package if you are using older specs

const app = require('koa')();
const docs = require('koa-docs');

// Create a path for viewing the docs (only GET method is supported)
app.use(docs.get('/docs', {
   title: 'Pet Store API',
   version: '1.0.0',

   theme: 'simplex',    // Specify a theme from www.bootswatch.com;
                        // default is un-themed bootstrap

   routeHandlers: 'disabled',  // Hide the route implementation code from docs

   groups: [
      { groupName: 'Pets', routes: [/*  ... route specs ...  */] },
      { groupName: 'Store', routes: [/*  ... route specs ...  */] }
   ]
}));

app.listen(3000, (err) => {
   if (err) throw err;
   console.log(`Docs are available at http://localhost:3000/docs`);
});

Creates a koa middleware which generates and serves api documentation using the specs provided in the options object.

Arguments

  1. path (String): the GET path at which the documentation will be served
  2. options (Object)

Returns

(GeneratorFunction): Middleware suitable for use in koa.js app

Groups are used to logically display the various sections of your api. They are declared as follows:

The route specs are the same as koa-joi-router, therefore, those routes can be used directly with koa-docs. Specifications are as follows:

In addition to the above options, koa-docs looks for the following properties in the meta object of each route:

Please feel free to claim any of the following features for development; more features can be requested by opening an issue.

MIT


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4