[Catalyst] Catalyst::*::REST and Javascript

J. Shirley jshirley at gmail.com
Wed Aug 13 02:09:44 BST 2008


On Tue, Aug 12, 2008 at 3:20 PM, Mark Trostler <mark at zzo.com> wrote:
> Ya I agree that doc is a little wacky - I tend to craft my own urls & set
> the HTTP method appropriately - I stick the JSON-encoded data in a 'data'
> request parameter & have my auto sub in my Root controller peel it off of
> there & put it in $c->data so it all looks the same after that.
>
> like:
>
>    if (my $data = $c->stash->{raw_params}->{data}) {
>        $c->req->data(decode_json($data));
>    }
>
>
>        Mark
>

It may be worth considering Catalyst::Controller::REST to handle the
serialization and deserialization.  It works in much the same fashion,
but is very configurable and supports more types (even though I
recommend JSON, other people are more keen on other serialization
formats)

And if you aren't, definitely use Catalyst::View::JSON for sending
JSON back to the client for many different reasons, most of them in
the pod for C::V::JSON.



More information about the Catalyst mailing list