How to get the post parameter when posting to client


#1

How do I get the post parameter when routing in client, e.g.

Router.route('ClientRoot', {
    path: 'foor/bar'
}).post(function() {
    console.log(this.request.query);  // undefined
    console.log(this.params);  // query: Object __proto__: Object, so basically empty.
});

How do I get the paremeters in post?? I searched, but can’t get any info concerning this.


#2

I think you wouldn’t usually get POST data from client side routing. The best option if you really want to use POST here (although depending on what you’re doing there might be a better way) is to use server-side routing to save the POST data and then redirect to a GET page with appropriate URL params.

I think this is a general best practice for all webapps, since POST urls have a lot of problems, for example the weird stuff you get if you refresh the page (“your form will be resubmitted”).


#3

Yeah, I read the http protocol specs. Anyway, I’m ignorant in this kind of things, so that was kinda stupid.