fastify.addContentTypeParser('application/x-protobuf', function (req, done) { var data = '' req.on('data', chunk => { data += chunk }) req.on('end', () => { done(messages.PushRequest.decode(data)) }) })
// curl -X POST -d '{"hello":"world", "key": "fastify-body-parser"}' -H'Content-type: application/json' http://localhost:3005/ fastify.addContentTypeParser('application/json', function (req, done) { jsonParser(req, function (err, body) { done(err, body) }) })