From: Matt Todd Date: 2009-01-25T00:51:05+09:00 Subject: Re: Desktop <-> Web --0015175cb1001e2d3104613c80f7 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit There's not much in Halcyon you'll find beyond what you've already learned here. The interesting bit, I guess, would be the PostBodyContentTypeParser middleware. Apologies for the name, haha. I wrote the middleware to compliment Halcyon since everything coming out of it was JSON I figured it should at least support it coming in. Halcyon behaves very similar to what's going on in your application... essentially it breaks down to a simplistic pattern: always have a resource (a hash or an array of hashes, for example) to respond with as JSON objects. A lot of the time it was just calling #to_json on an object as the body of the response. Aside from that, everything is as you'd expect. I recommend JSON wholeheartedly. Matt On Fri, Jan 23, 2009 at 10:41 PM, hemant wrote: > On Sat, Jan 24, 2009 at 2:51 AM, Brian Candler > wrote: > > I also learned from the Sinatra list that there is a Rack middleware > > module you can load which which will perform the parsing of JSON POST > > data for you, so it just ends up in params. Tidy. > > > > http://groups.google.com/group/sinatrarb/msg/6579132bee5fc0b2 > > > > > http://github.com/rack/rack-contrib/blob/44322288f263dda0743183529efe4e04a240e76c/lib/rack/contrib/post_body_content_type_parser.rb > > If sole purpose is to ferry back JSON back forth, one may have a look at: > > http://halcyon.rubyforge.org/ > > Also, why bother converting JSON to YAML on ruby side? Marshalling > Ruby objects to JSON is equally easier. If you are using AR or > something it already has support for that, otherwise JSON gem already > comes with support for marshalling built-in types which can be easily > extended to custom classes with to_json method. > > -- Matt Todd Highgroove Studios www.highgroove.com cell: 404-314-2612 blog: maraby.org Scout - Web Monitoring and Reporting Software www.scoutapp.com --0015175cb1001e2d3104613c80f7--