micro-visualize
Visualizes requests and responses for services written with micro
.
Screenshot
Installation
npm install --save micro-visualize
Or even better
yarn add micro-visualize
Import and Usage Example
const visualize = require('micro-visualize')
module.exports = visualize(async function (req, res) {
return 'Hello, world!'
})
API
visualize
Visualize requests and responses for a given function. The function is a no-op if log
is not dev
.
Parameters
fn
Function Async function, your normal micro
logic.log
String An optional log level (default: dev
)
Examples
const visualize = require('micro-visualize')
module.exports = visualize(async function (req, res) {
return 'Hello, world!'
})
const visualize = require('micro-visualize')
module.exports = visualize(async function (req, res) {
return 'Hello, world!'
}, process.env.NODE_ENV)
Returns an async Function.
Credits
Thanks to @rickharrison for his excellent PR which this project was heavily based on.