couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matthew King <automatt...@gmail.com>
Subject Abstracting the http interface
Date Sun, 24 Feb 2008 02:20:32 GMT
Back on the Google groups list,
On Feb 18, 2008, at 9:34 AM, kerr wrote:

> It should be pretty straight forward to remove the coupling
> here, presenting an interface that would just need simple request
> wrappers / transformers to use either mochiweb, inets or anything
> else.

With the stipulations that,

A) I'm an Erlang noob,
B) I have no idea how Damien wants to handle this,

I tentatively offer a rudimentary first attempt at a module intended  
to decouple the web server.  If I have understood things correctly,  
this would allow swapping out web servers simply by changing the  
httpd ChildSpec in couch_server_sup:init/1

Plain:
http://automatthew.s3.amazonaws.com/httpd_adapter.erl

Pretty:
http://automatthew.s3.amazonaws.com/couch_httpd_adapter.html

If you've sussed out mod_couch.erl, you can pretty much guess what  
this module does from the single export:

-export ([route/3]).

route(Method, PathList, QueryArgs) ->
   make(stuff, happen).

Mime
View raw message