You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@couchdb.apache.org by Mahendra Kariya <ma...@gmail.com> on 2010/06/03 10:06:22 UTC

using jquery.couch.js

Hi,

I created a javascript, to access CouchDB. It is as follows:

           var dbname = "mahendradb";

            $.couch.db(dbname).create({
                error:function(status,id,reason) { alert(status+" reason:
"+reason);},
                success:function(resp) { alert (resp); }
            });

This script is running on port 80. CouchDB is on port 5984.  So, obviously I
will get an error. The error is as follows.

Error: uncaught exception: Invalid JSON: <!DOCTYPE HTML PUBLIC "-//IETF//DTD
HTML 2.0//EN">
<html><head>
<title>405 Method Not Allowed</title>
</head><body>
<h1>Method Not Allowed</h1>
<p>The requested method PUT is not allowed for the URL /mahendradb/.</p>
<hr>
<address>Apache/2.2.14 (Ubuntu) Server at localhost Port 80</address>
</body></html>

How can I access CouchDB from port 80?

Re: using jquery.couch.js

Posted by J Chris Anderson <jc...@gmail.com>.
On Jun 3, 2010, at 1:06 AM, Mahendra Kariya wrote:

> 
> 
> How can I access CouchDB from port 80?

the simple answer in your case is to store your html files as binary attachments to a couchdb document, so that they don't have to reach across ports to make jquery requests, see for instance this:

http://couchapp.org/proto/_design/proto/index.html

Re: using jquery.couch.js

Posted by Nils Breunese <N....@vpro.nl>.
Markus Wolf wrote:

> you could configure your apache to proxy your couch in the same virtual
> host as your script runs.

Some notes on using Apache as a reverse proxy for CouchDB:
http://wiki.apache.org/couchdb/Apache_As_a_Reverse_Proxy

Instead of letting Apache serve your JavaScript file, you could put your
script in a CouchApp (and still use Apache as a reverse proxy if you
want to be able to access your CouchApp on port 80).

http://github.com/couchapp/couchapp
http://groups.google.com/group/couchapp
http://couchapp.org/

Nils.

De informatie vervat in deze  e-mail en meegezonden bijlagen is uitsluitend bedoeld voor gebruik door de geadresseerde en kan vertrouwelijke informatie bevatten. Openbaarmaking, vermenigvuldiging, verspreiding en/of verstrekking van deze informatie aan derden is voorbehouden aan geadresseerde. De VPRO staat niet in voor de juiste en volledige overbrenging van de inhoud van een verzonden e-mail, noch voor tijdige ontvangst daarvan.

Re: using jquery.couch.js

Posted by Markus Wolf <m....@hotornot.de>.
Hi,

you could configure your apache to proxy your couch in the same virtual
host as your script runs.

Markus

> Hi,
> 
> I created a javascript, to access CouchDB. It is as follows:
> 
>            var dbname = "mahendradb";
> 
>             $.couch.db(dbname).create({
>                 error:function(status,id,reason) { alert(status+" reason:
> "+reason);},
>                 success:function(resp) { alert (resp); }
>             });
> 
> This script is running on port 80. CouchDB is on port 5984.  So, obviously I
> will get an error. The error is as follows.
> 
> Error: uncaught exception: Invalid JSON: <!DOCTYPE HTML PUBLIC "-//IETF//DTD
> HTML 2.0//EN">
> <html><head>
> <title>405 Method Not Allowed</title>
> </head><body>
> <h1>Method Not Allowed</h1>
> <p>The requested method PUT is not allowed for the URL /mahendradb/.</p>
> <hr>
> <address>Apache/2.2.14 (Ubuntu) Server at localhost Port 80</address>
> </body></html>
> 
> How can I access CouchDB from port 80?
> 


-- 
Markus Wolf
Entwicklung

FaceValue Media GmbH
Max-Brauer-Allee 34
22765 Hamburg
Fon: +49 (0) 40 1888899-73
Fax: +49 (0) 40 1888899-873
E-Mail: m.wolf@hotornot.de

http://www.HOTorNOT.de - Europe's #1 rating site
Sitz der Gesellschaft: Breslauer Strasse 39
65830 Kriftel

Amtsgericht Frankfurt/M HRB 54159, UST-ID: DE 223646709
Geschäftsführung: Frank Böhmer