[Haskell-beginners] Simple warp-based server

Michael Snoyman michael at snoyman.com
Fri Jun 10 10:25:33 CEST 2011

Hi Michael,

Using WAI/Warp for this sounds reasonable. WAI actually works very
nicely with aeson, as they both use blaze-builder and
attoparsec-enumerator allows JSON values to be parsed directly from
the request body stream. I've put together an example of both the
server and client for the next Yesod cookbook blog post:



On Thu, Jun 9, 2011 at 6:45 PM, Michael Xavier <nemesisdesign at gmail.com> wrote:
> Hi Haskell Beginners,
> I am writing a fairly simple app in haskell that will be used to support
> some Ruby on Rails apps at work. The gist of it is that it takes a JSON
> request and produces a JSON response. I've figured that strapping it to a
> web server will be the easiest way to allow our Rails apps to talk to it
> without worrying about IPC and all of that. I looked at yesod and snap and
> both seemed to be too much for what I'm asking. It seems to me that the best
> approach would be to write up an WAI interface, strap it to a Warp server
> and call it a day.
> 1) Is my reasoning about the approach to take sound or is there an
> alternative I haven't considered? My app will have 1 path (or rather won't
> care about the request path) and will take its input by just reading the
> request body.
> 2) Could anyone recommend what I need to read to take this approach? I
> started looking at Warp and WAI documentation and found I was well over my
> head as I have no knowledge of Iterators/Iteratees/Enumerators nor Builders,
> but I'm definitely willing to learn if that's what it takes.
> --
> Michael Xavier
> http://www.michaelxavier.net
> _______________________________________________
> Beginners mailing list
> Beginners at haskell.org
> http://www.haskell.org/mailman/listinfo/beginners

More information about the Beginners mailing list