incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Mitchell <monch1...@gmail.com>
Subject Re: Building Erlang app around CouchDB
Date Wed, 22 Apr 2009 20:51:11 GMT
OK, I think I've got two of the key pieces in place:
- I can use MochiWeb to construct a Web framework pretty easily (note to
self: why haven't I bothered to look at Yaws alternatives before?)
- I can use eCouch to have MochiWeb interface with CouchDB

In other words,
Web client --> (REST call) --> MochiWeb --> eCouch --> CouchDB
and I haven't had to go outside of Erlang

I put together a very quick couple of pages today with this setup and it
worked fine.

What I'm still not seeing is a way to do XML<->JSON conversions within
Erlang.  Are there libraries out there that do this, or do I have to resort
to something like JavaScript (or try to come up with my own Erlang-based
solution)?

Thanks in advance

Dave M.



2009/4/21 Noah Slater <nslater@apache.org>

> On Tue, Apr 21, 2009 at 09:16:37PM +1000, David Mitchell wrote:
> > I want to be able to build an application around CouchDB that lets me
> load
> > in XML documents (i.e. converting XML to JSON within Erlang, rather than
> via
> > e.g. a Rails application talking to CouchDB).  I also want to be able to
> > extract data from CouchDB as XML documents, again doing all the
> JSON<->XML
> > conversion within Erlang rather than a separate language.  The whole
> thing
> > should work as a Web service (either REST or SOAP would be fine, although
> I
> > imagine REST should be easier as CouchDB itself has a REST interface).
>
> This sounds like a good opportunity to work with the grain of CouchDB and
> HTTP.
>
>  By eschewing shared state, and enforcing a uniform interface, we restrict
>  components from “seeing” beyond the context of an individual request. This
>  introduces a “pipe and filter” style property to the system, where access
> or
>  functionality can be added, modified, or restricted transparently between
>  client and server.
>
>  Common features such as authentication, authorization, caching,
> compression,
>  partitioning, proxying, tunneling, encryption or URI rewriting are
> possible by
>  placing standard applications such as Apache httpd or nginx in front of
> your
>  server. You’re free to augment, adapt or limit your setup as you see fit.
>  Figure 1-7 shows an example configuration of layered Web architecture.
>
>  Need some caching? Just throw in a cache between your server and clients.
> Need
>  some load balancing or authentication? Just throw in a reverse proxy.
>
>      - Layered System, CouchDB: TDG,
> http://books.couchdb.org/relax/why-couchdb
>
> Need media type conversion? Throw in a proxy!
>
>  Intermediary components act as both a client and a server in order to
> forward,
>  with possible translation, requests and responses. A proxy component is an
>  intermediary selected by a client to provide interface encapsulation of
> other
>  services, data translation, performance enhancement, or security
> protection.
>
>        -
> http://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm<http://www.ics.uci.edu/%7Efielding/pubs/dissertation/rest_arch_style.htm>
>
> See Figure 5-10, ibid.
>
> Best,
>
> --
> Noah Slater, http://tumbolia.org/nslater
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message