[erlang-questions] what is mochiweb for?
Tue Jul 22 18:42:09 CEST 2008
On 7/22/08 12:13 PM, "Howard Yeh" <hayeah@REDACTED> wrote:
> I've seen it mentioned and used in few places (couchdb), but I am
> confused what niche it's designed for, vs the inet library and yaws.
You'd have to ask the mochi guys what it's designed for, but as
a heavy user I can tell you some of what it's good for.
I think of it as a programmable HTTP server layer. The inet library
is a handy library, but not really a fully capable Web server.
Yaws, on the other hand, is closer to Apache -- very capable, but
with many of its own ideas about how to build your Web systems.
Mochiweb does the heavy lifting on your outward-facing HTTP
connections, leaving you to write your application-specific
server logic. It provides useful abstractions over the request
and response, and manages your client connections and other details
of pushing data between your code and your clients. It doesn't
do too much for you beyond that, which is actually a plus;
this means that it's straightforward to extend as part of another
system. If you want to stick with your original comparison,
you might see it as a sweet spot or a local maximum in the
spectrum between inets and yaws when it comes to building
interesting Web applications.
We've written an application (I am staying away from the term
"framework" here) which uses mochiweb as the core HTTP engine
but also automates the core logic of HTTP semantics that all
Web apps should follow. It then provides obvious, extensible
places to connect with application-specific code. We'll release
that system -- "Webmachine" -- as open source when we get a
bit of free time to package it up.
More information about the erlang-questions