Clients post protocol buffers to my url. I need to get the payload to I can parse. I am using express but I will take anything that works.
app.post('/n/bidder', function(req, res){
var payload = ??????;
var mypb_schema = schema['Feeds'];
var brr_fu = mypb_schema.parse(payload);
});
Thanks
You have to receive the payload from the req
input stream and combine the parts:
var buffertools = require('buffertools');
app.post('/n/bidder', function (req, res) {
var payload = [];
req.on('data', function (data) {
payload.push(data);
});
req.on('end', function () {
var payload = buffertools.concat.apply(null, payload);
var mypb_schema = schema['Feeds'];
var brr_fu = mypb_schema.parse(payload);
// rest of code here
});
});