MacPython Logo from __future__ import *

buy music albums Silver Apples buy mp3 albums Tarrus Riley buy tracks mp3 Kravits buy Reaper albums mp3 buy Kravits albums music buy music Evita CD online albums mp3 Silver Apples download Madonna CD music buy tracks music Kravits download music albums Silver Apples

2007-11-07

mochiweb - another faster web server

Filed under: erlang, mochiweb — bob @ 9:39 pm

mochiweb is finally well on its way to becoming a proper open source project, thanks to Matthew Dempsky. We've got a mochiweb project on google code and a mochiweb group on google groups.

Similarly interesting is that iserve is now turning into something more useful. iserve and mochiweb are pretty much the same thing under the hood, but mochiweb exposes a different API (which I find to be nicer, but I designed it) and supports more of the HTTP protocol. They both (ab)use inets' {packet, http} mode and they're both very minimal.

Here's a mochiweb version of the minimal example that Tobbe gave for iserve:

-module(mochiweb_demo).
-export([mochiweb_request/1, start/1]).

start(Port) ->
    mochiweb_http:start([{port, Port}, {loop, {?MODULE, mochiweb_request}}]).

mochiweb_request(Req) ->
    Req:ok({"text/html",
    <<"<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">
        <html>
        <head><title >Welcome to mochiweb</title></head>
        <body>
            Hello
        </body>
        </html>">>}).

Powered by WordPress