A tool for outputting routing information into .md
files
npm install beanify-markdown --save
with yarn
yarn add beanify-markdown
base example
const Beanify = require('beanify')
const Plugin = require('beanify-markdown')
const beanify = Beanify({})
beanify
.register(Plugin, {
dir: 'out'
})
.route({
url: 'math.asin',
md: {
name: 'asin',
desc: 'function returns the arcsine (in radians) of a number'
},
handler (req, rep) {}
})
.ready(e => {
e && beanify.$log.error(e.message)
beanify.print()
})
with beanify-url
.
const Beanify = require('beanify')
const beanifyAjv = require('beanify-ajv')
const beanifyUrl = require('beanify-url')
const Plugin = require('beanify-markdown')
const beanify = Beanify({})
beanify
.register(Plugin, {
dir: '.out-url'
})
.register(beanifyAjv, {
ajv: {
useDefaults: true,
coerceTypes: true
}
})
.register(beanifyUrl)
.route({
url: 'math.:action',
md: {
name: 'math.action',
desc: 'function returns the arcsine (in radians) of a number'
},
schema: {
body: {
type: 'number'
},
attribute: {
type: 'object',
properties: {
token: {
type: 'string'
}
}
},
params: {
type: 'object',
properties: {
action: {
type: 'string'
}
}
}
},
handler (req, rep) {}
})
.route({
url: 'time.:action',
md: {
name: 'time.action'
},
schema: {
body: {
type: 'number'
},
attribute: {
type: 'object',
properties: {
token: {
type: 'string'
}
}
},
params: {
type: 'object',
properties: {
action: {
type: 'string'
}
}
}
},
handler (req, rep) {}
})
.ready(e => {
e && beanify.$log.error(e.message)
beanify.print()
})
-
dir
:.md
document output directory -
title
: Title ofREADME.md
file
-
markdown
: aliasmd
-
name
: interface name -
description
: interface description.aliasdesc
-