Im using Meteor and meteor-react-router-ssr,
I’m trying to process the POST data and then render something with that
data, problem is that the only way I can do that is using the preRender
function mixed with the “req.on(‘data’)…”, once I finished grabbing
the POST data, the server already rendered the HTML and delivered to the
client. How to solve this?
const preRender = function(req, res) {
var body = [];//POST data container
//start proccessing the POST data
req.on('data', function(chunk) {
body.push(chunk);
}).on('end', function() {
body = Buffer.concat(body).toString();
// at this point, `body` has the entire request body stored in it as a string, but the server already did the rendering
});
}