micro-hoofs
v0.0.5
Published
Higher-order functions for your zeit/micro
Downloads
5
Readme
Higher-order functions for zeit/micro
compose()
- because it should be a part of es6 rightrespondToLivenessProbe
- to respond to k8s liveness probe with{"healthy": true}
parseJSONInput
- puts input json onreq.json
Example:
const cmd = input => ({
hello: input.world
})
module.exports = compose(
respondToLivenessProbe,
parseJSONInput,
process.env.NODE_ENV !== 'production' && visualize
)(async req => cmd(req.json))
curl localhost:3000
-> returns{"healthy": true}
curl -XPOST -d'{"world": "world!"}' http://localhost:3000
-> returns{"hello": "world!"}