I want to receive data with POST requests in my Meteor app. There's this code (server side):
__meteor_bootstrap__.app.stack.splice (0, 0, {
route: '/input',
handle: function(req, res, next) {
req.on('error', function(err) {
console.log('ERROR', err);
});
req.on('data', function(chunk) {
console.log('CHUNK');
});
req.on('end', function() {
console.log('END');
});
res.writeHead(200, {
'Content-Type': 'text/plain',
});
res.write('GOT IT!');
res.end();
}.future(),
});
The code does not work, callbacks with logs are never called. I've tried to move response code to end callback, but it doesn't help - the only change is that the request receives timeout instead of response.
What should I do?
Your code works for me without the future() call.