Return-Path: Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: (qmail 93343 invoked from network); 22 Apr 2009 21:11:10 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 22 Apr 2009 21:11:10 -0000 Received: (qmail 15024 invoked by uid 500); 22 Apr 2009 21:11:09 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 14928 invoked by uid 500); 22 Apr 2009 21:11:08 -0000 Mailing-List: contact user-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@couchdb.apache.org Delivered-To: mailing list user@couchdb.apache.org Received: (qmail 14918 invoked by uid 99); 22 Apr 2009 21:11:08 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 22 Apr 2009 21:11:08 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of dionne@dionne-associates.com designates 67.222.38.37 as permitted sender) Received: from [67.222.38.37] (HELO outbound-mail-147.bluehost.com) (67.222.38.37) by apache.org (qpsmtpd/0.29) with SMTP; Wed, 22 Apr 2009 21:10:58 +0000 Received: (qmail 30310 invoked by uid 0); 22 Apr 2009 21:06:23 -0000 Received: from unknown (HELO host183.hostmonster.com) (74.220.207.183) by outboundproxy5.bluehost.com with SMTP; 22 Apr 2009 21:06:23 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=dionne-associates.com; h=Received:Mime-Version:In-Reply-To:References:Content-Type:Message-Id:Content-Transfer-Encoding:From:Subject:Date:To:X-Mailer:X-Identified-User; b=oO3jK1qv5ESx44ZqxW3RUMH4uwvSHJX3No4ew5fCfa2qk9W89FYcGeiadqULfFHxHc8OY+aaSa9a6CfpOiSl/geJ7UaW0XxeKN1mBH5DhE5TNHMH+3iUZjxqv8TA3+zh; Received: from h-67-101-158-162.nycmny83.dynamic.covad.net ([67.101.158.162] helo=[192.168.2.2]) by host183.hostmonster.com with esmtpa (Exim 4.69) (envelope-from ) id 1LwjiF-0001EH-Hc for user@couchdb.apache.org; Wed, 22 Apr 2009 15:10:36 -0600 Mime-Version: 1.0 (Apple Message framework v753.1) In-Reply-To: References: <20090421113048.GC9728@tumbolia.org> Content-Type: text/plain; charset=WINDOWS-1252; delsp=yes; format=flowed Message-Id: <97ADECB8-5E76-4DC8-A397-438590E12966@dionne-associates.com> Content-Transfer-Encoding: quoted-printable From: Robert Dionne Subject: Re: Building Erlang app around CouchDB Date: Wed, 22 Apr 2009 17:09:54 -0400 To: user@couchdb.apache.org X-Mailer: Apple Mail (2.753.1) X-Identified-User: {2551:host183.hostmonster.com:dionneas:dionne-associates.com} {sentby:smtp auth 67.101.158.162 authed with dionne@dionne-associates.com} X-Virus-Checked: Checked by ClamAV on apache.org I'm not quite sure what it is you are trying to do but it seems like =20 you don't need the ecouch in the middle if you're already using =20 MochiWeb. Anyway I put together an erlang client for some testing[1] that is =20 implemented as a gen_server and uses either inets or ibrowse. Feel =20 free to push it along if it's useful to you. It evolved from another=20 [2], which has been discontinued. Cheers, Bob [1] http://github.com/bdionne/erl-couch/tree/master [2] http://code.google.com/p/erlcouch/ On Apr 22, 2009, at 4:51 PM, David Mitchell wrote: > OK, I think I've got two of the key pieces in place: > - I can use MochiWeb to construct a Web framework pretty easily =20 > (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 =20 > 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 =20 > to resort > to something like JavaScript (or try to come up with my own Erlang-=20 > based > solution)? > > Thanks in advance > > Dave M. > > > > 2009/4/21 Noah Slater > >> 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 =20 >>> lets me >> load >>> in XML documents (i.e. converting XML to JSON within Erlang, =20 >>> rather than >> via >>> e.g. a Rails application talking to CouchDB). I also want to be =20 >>> 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, =20 >>> although >> I >>> imagine REST should be easier as CouchDB itself has a REST =20 >>> interface). >> >> This sounds like a good opportunity to work with the grain of =20 >> CouchDB and >> HTTP. >> >> By eschewing shared state, and enforcing a uniform interface, we =20 >> restrict >> components from =93seeing=94 beyond the context of an individual =20 >> request. This >> introduces a =93pipe and filter=94 style property to the system, =20 >> where access >> or >> functionality can be added, modified, or restricted transparently =20= >> 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 =20 >> front of >> your >> server. You=92re free to augment, adapt or limit your setup as you =20= >> see fit. >> Figure 1-7 shows an example configuration of layered Web =20 >> architecture. >> >> Need some caching? Just throw in a cache between your server and =20 >> clients. >> Need >> some load balancing or authentication? Just throw in a reverse =20 >> 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 =20 >> order to >> forward, >> with possible translation, requests and responses. A proxy =20 >> component is an >> intermediary selected by a client to provide interface =20 >> encapsulation of >> other >> services, data translation, performance enhancement, or security >> protection. >> >> - >> http://www.ics.uci.edu/~fielding/pubs/dissertation/=20 >> rest_arch_style.htm> dissertation/rest_arch_style.htm> >> >> See Figure 5-10, ibid. >> >> Best, >> >> -- >> Noah Slater, http://tumbolia.org/nslater >>