Reputation: 457
Meteor 1.2
Router.route('/upload', {
where: 'server',
action: function(){
console.log(this.request.body);
this.response.end(JSON.stringify(this.request.body));
}
});
I am using the lines mentioned in earlier issues.
if (Meteor.isServer) {
Router.onBeforeAction(Iron.Router.bodyParser.urlencoded({
extended: false
}));
}
Still the response is {}. Did this break with meteor 1.2? What is the solution now?
Upvotes: 0
Views: 338
Reputation: 11
// this is my route
Router.map(function(){
this.route('/posted',{where:'server'})
.post(function(){
console.log(this.request.body);
this.response.end('post request\n');
});
});
// this is my form
<form method="post" action="http://localhost:3000/posted">
<input name="test" value="blah"></input>
<input type="submit" value="Submit"></input>
</form>
// this is my reply on server's console
//I20151026-12:27:21.421(-6)? { test: 'blah' }
hope this helps
Upvotes: 1