mochiweb - another faster web server
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>">>}).
Cool! Erlang, in the wild.
Comment by Joe Grossberg — 2007-11-08 @ 7:38 am
God I love Mochiweb. It’d be nice to see more examples/documentation, but all-in-all it is an _excellent_ framework/server.
Comment by Matt Williamson — 2008-12-22 @ 7:55 am
Wow, it’s best announcement of mochiweb for me. It shows me exactly what I want from erlang web framework, be KISS.
Comment by Hynek (Pichi) Vychodil — 2009-01-11 @ 3:41 am
Thanks for your great effort! it is the best present for my new year! thank you!
Comment by michael — 2009-01-20 @ 12:08 am
Two quick questions:
- Saw the Google Code site, but there is no download. Me wants. When? :)
- Why “another” in your title? Are you referring to “iserve” or some other webserver?
Comment by betadog — 2009-02-24 @ 11:49 am
Mochiweb is available for free download at GoogleCode under the ‘Source’ tab.
If you don’t have a SVN client, I would recommend you RapidSVN (http://rapidsvn.tigris.org/).
Comment by Nikola Petkanski — 2009-04-16 @ 5:12 am