Research
Security News
Threat Actor Exposes Playbook for Exploiting npm to Build Blockchain-Powered Botnets
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.
@appliedblockchain/koa-docs
Advanced tools
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
title
: string representing the page title; displayed at the top of the docsversion
: string representing api version; also displayed at top of the docsrouteHandlers
: string indicating whether to show the route handler code in the docs. Options are disabled, expanded or collapsed (collapsed is the default)theme
: string name of a theme from bootswatch to be used as the default themegroups
: array of group specs as described belowReturns
(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:
groupName
: string representing the name of the groupdescription
: string that describes the group; keep this short at about 1 scentence. This is displayed in both expanded and collapsed states as well as in tooltips. This should be a simple string; no markdownextendedDescription
: string that supports markdown and is displayed only in when a group is being displayed in an expanded state. Make this as long as you need.prefix
: optional string to be prefixed to all route paths in this grouproutes
: array of route specs representing the routes in this group. See below for details on route specs.The route specs are the same as koa-joi-router, therefore, those routes can be used directly with koa-docs
. Specifications are as follows:
method
: required HTTP method like "get", "post", "put", etcpath
: required stringvalidate
header
: object which conforms to Joi validationquery
: object which conforms to Joi validationparams
: object which conforms to Joi validationbody
: object which conforms to Joi validationmaxBody
: max incoming body size for forms or json inputfailure
: HTTP response code to use when input validation fails. default 400
type
: if validating the request body, this is required. either form
, json
or multipart
output
: output validator object which conforms to Joi validation. if output is invalid, an HTTP 500 is returnedcontinueOnError
: if validation fails, this flags determines if koa-joi-router
should continue processing the middleware stack or stop and respond with an error immediately. useful when you want your route to handle the error response. default false
handler
: required GeneratorFunctionmeta
: meta data about this route. koa-joi-router
ignores this but stores it along with all other route dataIn addition to the above options, koa-docs
looks for the following properties in the meta
object of each route:
friendlyName
: string which is used in the sidebar and route title; route path is used if this is not proivdeddescription
: string that describes the routes; keep this short at about 1 scentence. This is displayed in both expanded and collapsed states as well as in tooltips. This should be a simple string; no markdownextendedDescription
: string that supports markdown and is displayed only in when a route is being displayed in an expanded state. Make this as long as you need.Please feel free to claim any of the following features for development; more features can be requested by opening an issue.
FAQs
An automatic documentation generator for koa.js APIs
The npm package @appliedblockchain/koa-docs receives a total of 29 weekly downloads. As such, @appliedblockchain/koa-docs popularity was classified as not popular.
We found that @appliedblockchain/koa-docs demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 26 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.
Security News
NVD’s backlog surpasses 20,000 CVEs as analysis slows and NIST announces new system updates to address ongoing delays.
Security News
Research
A malicious npm package disguised as a WhatsApp client is exploiting authentication flows with a remote kill switch to exfiltrate data and destroy files.