micro-body
Simple body parser for microUse it as expected in your micro module:
const microBody = require('micro-body')
module.exports.POST = async (req, res) => {
let body = await microBody(req)
return body
}
micro-body can parse
urlencoded
and json
body types, but throws an error if content-type
header has another type.If request hasn't got body or no
content-type
header is present micro-body returns an empty object { }
.