[Haskell-cafe] Light and fast http server

Jeremy Shaw jeremy at n-heptane.com
Sat Mar 12 20:00:37 CET 2011


On Mar 11, 2011, at 4:39 PM, Victor Oliveira wrote:

> Hi cafe,
>
> There are a lot of http servers in hackage. I didn't have used none.
> I would like to know if one of them is something closer of the nginx.
> I need some light and fast. It don't need support all http, just the  
> basics is fine.
> Suggestions?

What do you mean by 'the basics'?

happstack, yesod, and snap are all frameworks for building web  
applications.

But it sounds like you are just looking for a web server to server  
static content for the disk? If so, what is the advantage you hope to  
get by using Haskell over nginx ?

Any of the high-level frameworks can server static content pretty  
trivially. For example in Happstack you would just do:

 > module Main where
 >
 > import Happstack.Server (Browsing(EnableBrowsing), nullConf,  
serveDirectory, simpleHTTP)
 >
 > main :: IO ()
 > main = simpleHTTP nullConf $ serveDirectory EnableBrowsing [] "."
To serve files from the current directly.
If that is all you really need, then I would probably recommend warp +  
wai-app-static,
http://hackage.haskell.org/package/wai-app-static
Warp is pretty darn fast. Though, in practice I think you will find  
that all of the frameworks/servers are going to have very similar  
results for serving static files since they all call sendfile() to do  
the bulk of the transfer.
If you are looking for other features, then you need to say what those  
features are..
- jeremy




More information about the Haskell-Cafe mailing list