httpd module vs inets {packet,http}

Matthias Lang matthias@REDACTED
Wed Mar 8 09:06:12 CET 2006


A "REST" web service seems to be some sort philosophy for how to
design a service. For the purpose of "how do I do this in Erlang", I
think it just boils down to "how do I serve dynamically generated web
pages". If it's not, then my answer probably misses the point.

So: if you just want to serve dynamic web pages, you can choose
between two ready-made web servers: OTP's httpd and YAWS. Both web
servers are used in the real world. They have different peformance
tradeoffs and different approaches to interfacing with 'your'
application. YAWS seems to be more popular for new applications. If
you can't make up your mind about which one to use, flip a coin.

The OTP httpd interface you probably want to use is 'mod_esi':

  http://www.erlang.org/doc/doc-5.4.12/lib/inets-4.6.2/doc/html/mod_esi.html

Writing code to use it is straightforward, the hard part is all the
fudging around with httpd.conf.

If, on the other hand, you want to write your own web server 'from
scratch', then the undocumented http mode of the packet driver is
useful. That's what the 'howto' you found is about.

Matthias

--------------------

Ryan Rawson writes:
 > Hi all,
 > 
 > I read the 'fast httpd' howto from trapexit.org, and I also looked at
 > the httpd module in OTS.  I'm a little confused - it seems to me that
 > the httpd howto doesn't use the httpd module, it uses a undocumented
 > feature of the packet driver (which may in turn internally use the
 > httpd module).  While the httpd documentation seems to describe
 > callbacks but its kind of thinly documented.  Not the end of the
 > world, but I'm confused - what is the recommended thing to do here? 
 > What do other people do?  Say for example, creating a REST "web
 > service" ?
 > 
 > Thanks in advance for any tips and hints.
 > -ryan



More information about the erlang-questions mailing list