You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@couchdb.apache.org by "john.tiger" <jo...@gmail.com> on 2012/09/18 16:52:18 UTC

does jquery.couch actually work ?

I believe no.  I have yet to see a working snippet of code where it runs 
without couchapp (and not even sure with couchapp )

then there is broken documentation - take the Bradley Holt blog - nicely 
organized but not accurate.  Take the example of user signup.
$.couch.signup(userDoc, "secretpassword"), {
   success: ......
}

The resulting http request is listed as:
PUT http://localhost:5984/_users/org.couchdb.user%3Abob

but where is the actual username and password in the http request ?

I can accept that we might be missing something, but can anyone vouch
that they actually have this working in a non couchapp app?

Re: does jquery.couch actually work ?

Posted by Robin Berjon <ro...@berjon.com>.
On Sep 18, 2012, at 17:48 , "john.tiger" <jo...@gmail.com> wrote:
> On 09/18/2012 09:11 AM, Zera Holladay wrote:
>>> but where is the actual username and password in the http request ?
>> In the body of the request.
> 
> okay, but this is missing (ie left for reader to figure out - which is difficult - we're trying to work thru all this

There's nothing particularly hard in looking at what's going on over the wire. For instance, the Net tab in Firebug (or any other browser debugging tool) will show you the request, with full headers, body, etc.

I have yet to experiment with that, but the Couch API is also a great match for Angular's bindings and deferreds.

-- 
Robin Berjon - http://berjon.com/ - @robinberjon


Re: does jquery.couch actually work ?

Posted by Ryan Ramage <ry...@gmail.com>.
Also, to be aware, there are other light js libs for access couchdb. A
new favorite of mine, courtesy of Caolan McMahon,  is couchr, which
can be found here:
http://jamjs.org/packages/#/details/couchr
Works the same in the browser and in node.

There is also browser-request: from iriscouch.
https://github.com/iriscouch/browser-request
I am sure there are others as well.

The above are a little more modern then jquery.couch.js Hope that helps

Ryan


On Tue, Sep 18, 2012 at 10:51 AM, Simon Metson <si...@cloudant.com> wrote:
> Hi John,
> I've got jquery.couch.js working in a few places, I'll try to extract a
> gist on teh train home tomorrow. If you can put your code somewhere
> (ideally in a live setting, like Iris or Cloudant) I'm happy to take a look
> at it.
>
> That said, jquery has moved on a lot more than jquery.couch.js, and
> jquery.couch.js is starting to show it's age. All jquery.couch.js really is
> is an aide-mémoire for the CouchDB API, and learning that is more useful
> IMHO since it's portable across languages. Recently I've been just using
> jquery calls to Couch directly without the jquery.couch.js in the middle.
> It works well, and there's one less moving part. Hooking up something like
> Backbone is also simple and can be done without any additional
> libraries/connectors.
>
> Cheers
> Simon
>
> On Tue, Sep 18, 2012 at 5:07 PM, Noah Slater <ns...@tumbolia.org> wrote:
>
>> Check out Futon's source. That is about as canonical an example as you're
>> going to get.
>>
>> On Tue, Sep 18, 2012 at 4:48 PM, john.tiger <john.tigernassau@gmail.com
>> >wrote:
>>
>> > On 09/18/2012 09:11 AM, Zera Holladay wrote:
>> >
>> >> Futon is built with jquery.couch.
>> >>
>> >
>> > okay so source should show examples - though this is a couchapp I believe
>> >
>> >  The resulting http request is listed as:
>> >>> PUT http://localhost:5984/_users/**org.couchdb.user%3Abob<
>> http://localhost:5984/_users/org.couchdb.user%3Abob>
>> >>>
>> >>> but where is the actual username and password in the http request ?
>> >>>
>> >> In the body of the request.
>> >>
>> >
>> > okay, but this is missing (ie left for reader to figure out - which is
>> > difficult - we're trying to work thru all this but examples would make it
>> > easier
>> >
>> >
>> > I can accept that we might be missing something, but can anyone vouch
>> > that they actually have this working in a non couchapp app?
>> >
>> >
>> >  Yes.
>> >>
>> >
>> > any example ?  gist ?  snippet?
>> >
>> > thks
>> >
>> >
>> >
>> >
>> >
>>
>>
>> --
>> NS
>>

Re: does jquery.couch actually work ?

Posted by "john.tiger" <jo...@gmail.com>.
On 09/21/2012 10:07 AM, Ryan Ramage wrote:
> John,
>
> It seems you are serving your html from port 80, but it is trying to
> access couchdb on port 5984. That is a cross domain request.
>
> using couch.jquery.js I think what you can do is fiddle with
>
> $.couch.urlPrefix = "/_couch";

I know there's a problem with the cross domain, however, having real 
trouble getting around it.  Currently the nginx config I listed is not 
working.

I'm puzzled by the "/_couch" prefix (what does the underscore do ?)  how 
does that change the cross domain problem ?



>
> R
>
>
>
> On Fri, Sep 21, 2012 at 9:50 AM, john.tiger<jo...@gmail.com>  wrote:
>> On 09/21/2012 09:09 AM, Simon Metson wrote:
>>> Do you get anything in either CouchDB or nginx logs?
>> from javascript console:
>>
>> XMLHttpRequest cannot load http://127.0.0.1:5984/testdb/_view/getuserdoc.
>> Origin http://127.0.0.1 is not allowed by Access-Control-Allow-Origin
>>
>> from /var/log/couchdb:
>> [Fri, 21 Sep 2012 15:37:39 GMT] [info] [<0.3712.0>] 127.0.0.1 - - GET
>> /testdb/_view/getuserdoc 404
>>
>> from
>> 2012/09/21 09:37:18 [emerg] 5001#0: "proxy_pass" cannot have URI part in
>> location given by regular expression, or inside named location, or inside
>> "if" statement, or inside "limit_except" block in
>> /etc/nginx/sites-enabled/dev-testdb:13
>> 2012/09/21 09:37:19 [emerg] 5002#0: "proxy_pass" cannot have URI part in
>> location given by regular expression, or inside named location, or inside
>> "if" statement, or inside "limit_except" block in
>> /etc/nginx/sites-enabled/dev-testdb:13
>>
>>
>>
>>>
>>> On Friday, 21 September 2012 at 16:07, john.tiger wrote:
>>>
>>>> On 09/21/2012 06:00 AM, Simon Metson wrote:
>>>>> Yup, you'll need to proxy CouchDB so that everything appears to come
>>>>> from the same server.
>>>>> http://wiki.apache.org/couchdb/Nginx_As_a_Reverse_Proxy might be a decent
>>>>> place to start.
>>>>
>>>> thks for this reference - still cannot get it to work - here is the file
>>>> (in sites-available symlinked to sites-enabled (nginx.conf is still the
>>>> default except with user added to top)
>>>>
>>>> any help appreciated
>>>>
>>>> server {
>>>> #listen 80; ## listen for ipv4; this line is default and implied
>>>> #listen [::]:80 default_server ipv6only=on; ## listen for ipv6
>>>>
>>>> root /home/work/couchdb/testdb;
>>>> index index.html index.htm;
>>>>
>>>> # Make site accessible from http://localhost/
>>>> server_name localhost;
>>>>
>>>> location ^/(.*)/_changes {
>>>> proxy_pass http://127.0.0.1:5984/;
>>>> proxy_redirect off;
>>>> proxy_buffering off;
>>>> proxy_set_header Host $host;
>>>> proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
>>>> }
>>>>
>>>> location /testdb {
>>>> rewrite /testdb/(.*) /$1 break;
>>>> proxy_pass http://127.0.0.1:5984/;
>>>> proxy_redirect off;
>>>> proxy_set_header Host $host;
>>>> proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
>>>> }
>>>> }
>>>>
>>>>
>>>>> On Thursday, 20 September 2012 at 22:04, john.tiger wrote:
>>>>>
>>>>>> On 09/20/2012 01:26 PM, Simon Metson wrote:
>>>>>>> Hey John,
>>>>>>> http://bradley-holt.com/2011/07/couchdb-jquery-plugin-reference/ might
>>>>>>> be a useful reference for you.
>>>>>>>
>>>>>>> I've got a working example that I'll put online tomorrow. It uses
>>>>>>> backbone Events to communicate when someone logs in/out, but if you don't
>>>>>>> need/want that removing it should be easy enough.
>>>>>>> Cheers
>>>>>>> Simon
>>>>>>>
>>>>>> hmm, I'm suspecting our stuff was "silently" failing - using straight
>>>>>> $.getjson call now shows:
>>>>>>
>>>>>> Origin http://127.0.0.1 is not allowed by Access-Control-Allow-Origin.
>>>>>>
>>>>>> the nginx conf is set up to render html pages at http://127.0.0.1
>>>>>>
>>>>>> wondering if the nginx conf needs a line:
>>>>>> location /<dbname>/ {proxy_pass http://127.0.0.1:5984;}
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>> On Wednesday, 19 September 2012 at 02:12, john.tiger wrote:
>>>>>>>
>>>>>>>> On 09/18/2012 04:32 PM, Simon Metson wrote:
>>>>>>>>> You're trying to do login/session/logout in Backbone? Give me a few
>>>>>>>>> days
>>>>>>>>> and I can write up an example app.
>>>>>>>>>
>>>>>>>> no not in Backbone, just in our own html5 and jquery code. Going thru
>>>>>>>> the jquery.couch lib and futon lib, I started to document the needed
>>>>>>>> calls - still not quite there - for example, to create a user (reader
>>>>>>>> type) do you still have to create the password hash first or does
>>>>>>>> couch
>>>>>>>> now do that ....
>>>>>>>>
>>>>
>>>


Re: does jquery.couch actually work ?

Posted by Ryan Ramage <ry...@gmail.com>.
John,

It seems you are serving your html from port 80, but it is trying to
access couchdb on port 5984. That is a cross domain request.

using couch.jquery.js I think what you can do is fiddle with

$.couch.urlPrefix = "/_couch";

R



On Fri, Sep 21, 2012 at 9:50 AM, john.tiger <jo...@gmail.com> wrote:
> On 09/21/2012 09:09 AM, Simon Metson wrote:
>>
>> Do you get anything in either CouchDB or nginx logs?
>
> from javascript console:
>
> XMLHttpRequest cannot load http://127.0.0.1:5984/testdb/_view/getuserdoc.
> Origin http://127.0.0.1 is not allowed by Access-Control-Allow-Origin
>
> from /var/log/couchdb:
> [Fri, 21 Sep 2012 15:37:39 GMT] [info] [<0.3712.0>] 127.0.0.1 - - GET
> /testdb/_view/getuserdoc 404
>
> from
> 2012/09/21 09:37:18 [emerg] 5001#0: "proxy_pass" cannot have URI part in
> location given by regular expression, or inside named location, or inside
> "if" statement, or inside "limit_except" block in
> /etc/nginx/sites-enabled/dev-testdb:13
> 2012/09/21 09:37:19 [emerg] 5002#0: "proxy_pass" cannot have URI part in
> location given by regular expression, or inside named location, or inside
> "if" statement, or inside "limit_except" block in
> /etc/nginx/sites-enabled/dev-testdb:13
>
>
>
>>
>>
>> On Friday, 21 September 2012 at 16:07, john.tiger wrote:
>>
>>> On 09/21/2012 06:00 AM, Simon Metson wrote:
>>>>
>>>> Yup, you'll need to proxy CouchDB so that everything appears to come
>>>> from the same server.
>>>> http://wiki.apache.org/couchdb/Nginx_As_a_Reverse_Proxy might be a decent
>>>> place to start.
>>>
>>>
>>> thks for this reference - still cannot get it to work - here is the file
>>> (in sites-available symlinked to sites-enabled (nginx.conf is still the
>>> default except with user added to top)
>>>
>>> any help appreciated
>>>
>>> server {
>>> #listen 80; ## listen for ipv4; this line is default and implied
>>> #listen [::]:80 default_server ipv6only=on; ## listen for ipv6
>>>
>>> root /home/work/couchdb/testdb;
>>> index index.html index.htm;
>>>
>>> # Make site accessible from http://localhost/
>>> server_name localhost;
>>>
>>> location ^/(.*)/_changes {
>>> proxy_pass http://127.0.0.1:5984/;
>>> proxy_redirect off;
>>> proxy_buffering off;
>>> proxy_set_header Host $host;
>>> proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
>>> }
>>>
>>> location /testdb {
>>> rewrite /testdb/(.*) /$1 break;
>>> proxy_pass http://127.0.0.1:5984/;
>>> proxy_redirect off;
>>> proxy_set_header Host $host;
>>> proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
>>> }
>>> }
>>>
>>>
>>>>
>>>> On Thursday, 20 September 2012 at 22:04, john.tiger wrote:
>>>>
>>>>> On 09/20/2012 01:26 PM, Simon Metson wrote:
>>>>>>
>>>>>> Hey John,
>>>>>> http://bradley-holt.com/2011/07/couchdb-jquery-plugin-reference/ might
>>>>>> be a useful reference for you.
>>>>>>
>>>>>> I've got a working example that I'll put online tomorrow. It uses
>>>>>> backbone Events to communicate when someone logs in/out, but if you don't
>>>>>> need/want that removing it should be easy enough.
>>>>>> Cheers
>>>>>> Simon
>>>>>>
>>>>>
>>>>> hmm, I'm suspecting our stuff was "silently" failing - using straight
>>>>> $.getjson call now shows:
>>>>>
>>>>> Origin http://127.0.0.1 is not allowed by Access-Control-Allow-Origin.
>>>>>
>>>>> the nginx conf is set up to render html pages at http://127.0.0.1
>>>>>
>>>>> wondering if the nginx conf needs a line:
>>>>> location /<dbname>/ {proxy_pass http://127.0.0.1:5984;}
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>> On Wednesday, 19 September 2012 at 02:12, john.tiger wrote:
>>>>>>
>>>>>>> On 09/18/2012 04:32 PM, Simon Metson wrote:
>>>>>>>>
>>>>>>>> You're trying to do login/session/logout in Backbone? Give me a few
>>>>>>>> days
>>>>>>>> and I can write up an example app.
>>>>>>>>
>>>>>>> no not in Backbone, just in our own html5 and jquery code. Going thru
>>>>>>> the jquery.couch lib and futon lib, I started to document the needed
>>>>>>> calls - still not quite there - for example, to create a user (reader
>>>>>>> type) do you still have to create the password hash first or does
>>>>>>> couch
>>>>>>> now do that ....
>>>>>>>
>>>>>>
>>>>>
>>>>
>>>
>>>
>>
>>
>

Re: does jquery.couch actually work ?

Posted by "john.tiger" <jo...@gmail.com>.
On 09/21/2012 09:09 AM, Simon Metson wrote:
> Do you get anything in either CouchDB or nginx logs?
from javascript console:

XMLHttpRequest cannot load 
http://127.0.0.1:5984/testdb/_view/getuserdoc. Origin http://127.0.0.1 
is not allowed by Access-Control-Allow-Origin

from /var/log/couchdb:
[Fri, 21 Sep 2012 15:37:39 GMT] [info] [<0.3712.0>] 127.0.0.1 - - GET 
/testdb/_view/getuserdoc 404

from
2012/09/21 09:37:18 [emerg] 5001#0: "proxy_pass" cannot have URI part in 
location given by regular expression, or inside named location, or 
inside "if" statement, or inside "limit_except" block in 
/etc/nginx/sites-enabled/dev-testdb:13
2012/09/21 09:37:19 [emerg] 5002#0: "proxy_pass" cannot have URI part in 
location given by regular expression, or inside named location, or 
inside "if" statement, or inside "limit_except" block in 
/etc/nginx/sites-enabled/dev-testdb:13


>
>
> On Friday, 21 September 2012 at 16:07, john.tiger wrote:
>
>> On 09/21/2012 06:00 AM, Simon Metson wrote:
>>> Yup, you'll need to proxy CouchDB so that everything appears to come from the same server. http://wiki.apache.org/couchdb/Nginx_As_a_Reverse_Proxy might be a decent place to start.
>>
>> thks for this reference - still cannot get it to work - here is the file
>> (in sites-available symlinked to sites-enabled (nginx.conf is still the
>> default except with user added to top)
>>
>> any help appreciated
>>
>> server {
>> #listen 80; ## listen for ipv4; this line is default and implied
>> #listen [::]:80 default_server ipv6only=on; ## listen for ipv6
>>
>> root /home/work/couchdb/testdb;
>> index index.html index.htm;
>>
>> # Make site accessible from http://localhost/
>> server_name localhost;
>>
>> location ^/(.*)/_changes {
>> proxy_pass http://127.0.0.1:5984/;
>> proxy_redirect off;
>> proxy_buffering off;
>> proxy_set_header Host $host;
>> proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
>> }
>>
>> location /testdb {
>> rewrite /testdb/(.*) /$1 break;
>> proxy_pass http://127.0.0.1:5984/;
>> proxy_redirect off;
>> proxy_set_header Host $host;
>> proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
>> }
>> }
>>
>>
>>>
>>> On Thursday, 20 September 2012 at 22:04, john.tiger wrote:
>>>
>>>> On 09/20/2012 01:26 PM, Simon Metson wrote:
>>>>> Hey John,
>>>>> http://bradley-holt.com/2011/07/couchdb-jquery-plugin-reference/ might be a useful reference for you.
>>>>>
>>>>> I've got a working example that I'll put online tomorrow. It uses backbone Events to communicate when someone logs in/out, but if you don't need/want that removing it should be easy enough.
>>>>> Cheers
>>>>> Simon
>>>>>
>>>>
>>>> hmm, I'm suspecting our stuff was "silently" failing - using straight
>>>> $.getjson call now shows:
>>>>
>>>> Origin http://127.0.0.1 is not allowed by Access-Control-Allow-Origin.
>>>>
>>>> the nginx conf is set up to render html pages at http://127.0.0.1
>>>>
>>>> wondering if the nginx conf needs a line:
>>>> location /<dbname>/ {proxy_pass http://127.0.0.1:5984;}
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>> On Wednesday, 19 September 2012 at 02:12, john.tiger wrote:
>>>>>
>>>>>> On 09/18/2012 04:32 PM, Simon Metson wrote:
>>>>>>> You're trying to do login/session/logout in Backbone? Give me a few days
>>>>>>> and I can write up an example app.
>>>>>>>
>>>>>> no not in Backbone, just in our own html5 and jquery code. Going thru
>>>>>> the jquery.couch lib and futon lib, I started to document the needed
>>>>>> calls - still not quite there - for example, to create a user (reader
>>>>>> type) do you still have to create the password hash first or does couch
>>>>>> now do that ....
>>>>>>
>>>>>
>>>>
>>>
>>
>>
>
>


Re: does jquery.couch actually work ?

Posted by Simon Metson <si...@cloudant.com>.
Do you get anything in either CouchDB or nginx logs? 


On Friday, 21 September 2012 at 16:07, john.tiger wrote:

> On 09/21/2012 06:00 AM, Simon Metson wrote:
> > Yup, you'll need to proxy CouchDB so that everything appears to come from the same server. http://wiki.apache.org/couchdb/Nginx_As_a_Reverse_Proxy might be a decent place to start.
> 
> 
> thks for this reference - still cannot get it to work - here is the file 
> (in sites-available symlinked to sites-enabled (nginx.conf is still the 
> default except with user added to top)
> 
> any help appreciated
> 
> server {
> #listen 80; ## listen for ipv4; this line is default and implied
> #listen [::]:80 default_server ipv6only=on; ## listen for ipv6
> 
> root /home/work/couchdb/testdb;
> index index.html index.htm;
> 
> # Make site accessible from http://localhost/
> server_name localhost;
> 
> location ^/(.*)/_changes {
> proxy_pass http://127.0.0.1:5984/;
> proxy_redirect off;
> proxy_buffering off;
> proxy_set_header Host $host;
> proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
> }
> 
> location /testdb {
> rewrite /testdb/(.*) /$1 break;
> proxy_pass http://127.0.0.1:5984/;
> proxy_redirect off;
> proxy_set_header Host $host;
> proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
> }
> }
> 
> 
> > 
> > 
> > On Thursday, 20 September 2012 at 22:04, john.tiger wrote:
> > 
> > > On 09/20/2012 01:26 PM, Simon Metson wrote:
> > > > Hey John,
> > > > http://bradley-holt.com/2011/07/couchdb-jquery-plugin-reference/ might be a useful reference for you.
> > > > 
> > > > I've got a working example that I'll put online tomorrow. It uses backbone Events to communicate when someone logs in/out, but if you don't need/want that removing it should be easy enough.
> > > > Cheers
> > > > Simon
> > > > 
> > > 
> > > 
> > > hmm, I'm suspecting our stuff was "silently" failing - using straight
> > > $.getjson call now shows:
> > > 
> > > Origin http://127.0.0.1 is not allowed by Access-Control-Allow-Origin.
> > > 
> > > the nginx conf is set up to render html pages at http://127.0.0.1
> > > 
> > > wondering if the nginx conf needs a line:
> > > location /<dbname>/ {proxy_pass http://127.0.0.1:5984;}
> > > 
> > > 
> > > 
> > > 
> > > 
> > > > 
> > > > On Wednesday, 19 September 2012 at 02:12, john.tiger wrote:
> > > > 
> > > > > On 09/18/2012 04:32 PM, Simon Metson wrote:
> > > > > > You're trying to do login/session/logout in Backbone? Give me a few days
> > > > > > and I can write up an example app.
> > > > > > 
> > > > > 
> > > > > no not in Backbone, just in our own html5 and jquery code. Going thru
> > > > > the jquery.couch lib and futon lib, I started to document the needed
> > > > > calls - still not quite there - for example, to create a user (reader
> > > > > type) do you still have to create the password hash first or does couch
> > > > > now do that ....
> > > > > 
> > > > 
> > > > 
> > > 
> > > 
> > 
> > 
> 
> 
> 



Re: does jquery.couch actually work ?

Posted by "john.tiger" <jo...@gmail.com>.
On 09/21/2012 06:00 AM, Simon Metson wrote:
> Yup, you'll need to proxy CouchDB so that everything appears to come from the same server. http://wiki.apache.org/couchdb/Nginx_As_a_Reverse_Proxy might be a decent place to start.

thks for this reference - still cannot get it to work - here is the file 
(in sites-available symlinked to sites-enabled (nginx.conf is still the 
default except with user added to top)

any help appreciated

server {
   #listen   80; ## listen for ipv4; this line is default and implied
   #listen   [::]:80 default_server ipv6only=on; ## listen for ipv6

   root /home/work/couchdb/testdb;
   index index.html index.htm;

   # Make site accessible from http://localhost/
   server_name localhost;

   location  ^/(.*)/_changes {
     proxy_pass http://127.0.0.1:5984/;
     proxy_redirect off;
     proxy_buffering off;
     proxy_set_header Host $host;
     proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
   }

   location /testdb {
     rewrite /testdb/(.*) /$1 break;
     proxy_pass http://127.0.0.1:5984/;
     proxy_redirect off;
     proxy_set_header Host $host;
     proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
   }
}


>
>
> On Thursday, 20 September 2012 at 22:04, john.tiger wrote:
>
>> On 09/20/2012 01:26 PM, Simon Metson wrote:
>>> Hey John,
>>> http://bradley-holt.com/2011/07/couchdb-jquery-plugin-reference/ might be a useful reference for you.
>>>
>>> I've got a working example that I'll put online tomorrow. It uses backbone Events to communicate when someone logs in/out, but if you don't need/want that removing it should be easy enough.
>>> Cheers
>>> Simon
>>>
>>
>> hmm, I'm suspecting our stuff was "silently" failing - using straight
>> $.getjson call now shows:
>>
>> Origin http://127.0.0.1 is not allowed by Access-Control-Allow-Origin.
>>
>> the nginx conf is set up to render html pages at http://127.0.0.1
>>
>> wondering if the nginx conf needs a line:
>> location /<dbname>/ {proxy_pass http://127.0.0.1:5984;}
>>
>>
>>
>>
>>
>>>
>>> On Wednesday, 19 September 2012 at 02:12, john.tiger wrote:
>>>
>>>> On 09/18/2012 04:32 PM, Simon Metson wrote:
>>>>> You're trying to do login/session/logout in Backbone? Give me a few days
>>>>> and I can write up an example app.
>>>>>
>>>> no not in Backbone, just in our own html5 and jquery code. Going thru
>>>> the jquery.couch lib and futon lib, I started to document the needed
>>>> calls - still not quite there - for example, to create a user (reader
>>>> type) do you still have to create the password hash first or does couch
>>>> now do that ....
>>>>
>>>
>>
>>
>
>


Re: does jquery.couch actually work ?

Posted by Simon Metson <si...@cloudant.com>.
Yup, you'll need to proxy CouchDB so that everything appears to come from the same server. http://wiki.apache.org/couchdb/Nginx_As_a_Reverse_Proxy might be a decent place to start.


On Thursday, 20 September 2012 at 22:04, john.tiger wrote:

> On 09/20/2012 01:26 PM, Simon Metson wrote:
> > Hey John,
> > http://bradley-holt.com/2011/07/couchdb-jquery-plugin-reference/ might be a useful reference for you.
> > 
> > I've got a working example that I'll put online tomorrow. It uses backbone Events to communicate when someone logs in/out, but if you don't need/want that removing it should be easy enough.
> > Cheers
> > Simon
> > 
> 
> 
> hmm, I'm suspecting our stuff was "silently" failing - using straight 
> $.getjson call now shows:
> 
> Origin http://127.0.0.1 is not allowed by Access-Control-Allow-Origin.
> 
> the nginx conf is set up to render html pages at http://127.0.0.1
> 
> wondering if the nginx conf needs a line:
> location /<dbname>/ {proxy_pass http://127.0.0.1:5984;}
> 
> 
> 
> 
> 
> > 
> > 
> > On Wednesday, 19 September 2012 at 02:12, john.tiger wrote:
> > 
> > > On 09/18/2012 04:32 PM, Simon Metson wrote:
> > > > You're trying to do login/session/logout in Backbone? Give me a few days
> > > > and I can write up an example app.
> > > > 
> > > 
> > > no not in Backbone, just in our own html5 and jquery code. Going thru
> > > the jquery.couch lib and futon lib, I started to document the needed
> > > calls - still not quite there - for example, to create a user (reader
> > > type) do you still have to create the password hash first or does couch
> > > now do that ....
> > > 
> > 
> > 
> 
> 
> 



Re: does jquery.couch actually work ?

Posted by "john.tiger" <jo...@gmail.com>.
On 09/20/2012 01:26 PM, Simon Metson wrote:
> Hey John,
> http://bradley-holt.com/2011/07/couchdb-jquery-plugin-reference/ might be a useful reference for you.
>
> I've got a working example that I'll put online tomorrow. It uses backbone Events to communicate when someone logs in/out, but if you don't need/want that removing it should be easy enough.
> Cheers
> Simon

hmm, I'm suspecting our stuff was "silently" failing - using straight 
$.getjson call now shows:

Origin http://127.0.0.1 is not allowed by Access-Control-Allow-Origin.

the nginx conf is set up to render html pages at http://127.0.0.1

wondering if the nginx conf needs a line:
location /<dbname>/ {proxy_pass http://127.0.0.1:5984;}





>
>
> On Wednesday, 19 September 2012 at 02:12, john.tiger wrote:
>
>> On 09/18/2012 04:32 PM, Simon Metson wrote:
>>> You're trying to do login/session/logout in Backbone? Give me a few days
>>> and I can write up an example app.
>>>
>> no not in Backbone, just in our own html5 and jquery code. Going thru
>> the jquery.couch lib and futon lib, I started to document the needed
>> calls - still not quite there - for example, to create a user (reader
>> type) do you still have to create the password hash first or does couch
>> now do that ....
>>
>>
>
>


Re: does jquery.couch actually work ?

Posted by Simon Metson <si...@cloudant.com>.
Hey John, 
http://bradley-holt.com/2011/07/couchdb-jquery-plugin-reference/ might be a useful reference for you. 

I've got a working example that I'll put online tomorrow. It uses backbone Events to communicate when someone logs in/out, but if you don't need/want that removing it should be easy enough.
Cheers
Simon


On Wednesday, 19 September 2012 at 02:12, john.tiger wrote:

> On 09/18/2012 04:32 PM, Simon Metson wrote:
> > You're trying to do login/session/logout in Backbone? Give me a few days
> > and I can write up an example app.
> > 
> 
> no not in Backbone, just in our own html5 and jquery code. Going thru 
> the jquery.couch lib and futon lib, I started to document the needed 
> calls - still not quite there - for example, to create a user (reader 
> type) do you still have to create the password hash first or does couch 
> now do that ....
> 
> 



Re: does jquery.couch actually work ?

Posted by Aliaksandr Barysiuk <a....@gmail.com>.
The hash is not needed for Couchdb 1.2, but is required for <1.2. (be aware that Cloudant has Couchdb v 1.0.2)

On 19/09/12 04:12, john.tiger wrote:
> On 09/18/2012 04:32 PM, Simon Metson wrote:
>> You're trying to do login/session/logout in Backbone? Give me a few days
>> and I can write up an example app.
> no not in Backbone, just in our own html5 and jquery code.  Going thru the jquery.couch lib and futon lib, I started 
> to document the needed calls - still not quite there - for example, to create a user (reader type) do you still have 
> to create the password hash first or does couch now do that ....
>
>
>


Re: does jquery.couch actually work ?

Posted by "john.tiger" <jo...@gmail.com>.
On 09/18/2012 04:32 PM, Simon Metson wrote:
> You're trying to do login/session/logout in Backbone? Give me a few days
> and I can write up an example app.
no not in Backbone, just in our own html5 and jquery code.  Going thru 
the jquery.couch lib and futon lib, I started to document the needed 
calls - still not quite there - for example, to create a user (reader 
type) do you still have to create the password hash first or does couch 
now do that ....




Re: does jquery.couch actually work ?

Posted by Simon Metson <si...@cloudant.com>.
You're trying to do login/session/logout in Backbone? Give me a few days
and I can write up an example app.

On Tue, Sep 18, 2012 at 8:22 PM, john.tiger <jo...@gmail.com>wrote:

> On 09/18/2012 10:51 AM, Simon Metson wrote:
>
>> That said, jquery has moved on a lot more than jquery.couch.js, and
>> jquery.couch.js is starting to show it's age. All jquery.couch.js really
>> is
>> is an aide-mémoire for the CouchDB API, and learning that is more useful
>> IMHO since it's portable across languages. Recently I've been just using
>> jquery calls to Couch directly without the jquery.couch.js in the middle.
>> It works well, and there's one less moving part. Hooking up something like
>> Backbone is also simple and can be done without any additional
>> libraries/connectors.
>>
>
> actually that's what we are looking at now - just having trouble trying to
> run login, session, logout from the REST call
>
>
>

Re: does jquery.couch actually work ?

Posted by "john.tiger" <jo...@gmail.com>.
On 09/18/2012 10:51 AM, Simon Metson wrote:
> That said, jquery has moved on a lot more than jquery.couch.js, and
> jquery.couch.js is starting to show it's age. All jquery.couch.js really is
> is an aide-mémoire for the CouchDB API, and learning that is more useful
> IMHO since it's portable across languages. Recently I've been just using
> jquery calls to Couch directly without the jquery.couch.js in the middle.
> It works well, and there's one less moving part. Hooking up something like
> Backbone is also simple and can be done without any additional
> libraries/connectors.

actually that's what we are looking at now - just having trouble trying 
to run login, session, logout from the REST call



Re: does jquery.couch actually work ?

Posted by Simon Metson <si...@cloudant.com>.
Hi John,
I've got jquery.couch.js working in a few places, I'll try to extract a
gist on teh train home tomorrow. If you can put your code somewhere
(ideally in a live setting, like Iris or Cloudant) I'm happy to take a look
at it.

That said, jquery has moved on a lot more than jquery.couch.js, and
jquery.couch.js is starting to show it's age. All jquery.couch.js really is
is an aide-mémoire for the CouchDB API, and learning that is more useful
IMHO since it's portable across languages. Recently I've been just using
jquery calls to Couch directly without the jquery.couch.js in the middle.
It works well, and there's one less moving part. Hooking up something like
Backbone is also simple and can be done without any additional
libraries/connectors.

Cheers
Simon

On Tue, Sep 18, 2012 at 5:07 PM, Noah Slater <ns...@tumbolia.org> wrote:

> Check out Futon's source. That is about as canonical an example as you're
> going to get.
>
> On Tue, Sep 18, 2012 at 4:48 PM, john.tiger <john.tigernassau@gmail.com
> >wrote:
>
> > On 09/18/2012 09:11 AM, Zera Holladay wrote:
> >
> >> Futon is built with jquery.couch.
> >>
> >
> > okay so source should show examples - though this is a couchapp I believe
> >
> >  The resulting http request is listed as:
> >>> PUT http://localhost:5984/_users/**org.couchdb.user%3Abob<
> http://localhost:5984/_users/org.couchdb.user%3Abob>
> >>>
> >>> but where is the actual username and password in the http request ?
> >>>
> >> In the body of the request.
> >>
> >
> > okay, but this is missing (ie left for reader to figure out - which is
> > difficult - we're trying to work thru all this but examples would make it
> > easier
> >
> >
> > I can accept that we might be missing something, but can anyone vouch
> > that they actually have this working in a non couchapp app?
> >
> >
> >  Yes.
> >>
> >
> > any example ?  gist ?  snippet?
> >
> > thks
> >
> >
> >
> >
> >
>
>
> --
> NS
>

Re: does jquery.couch actually work ?

Posted by Noah Slater <ns...@tumbolia.org>.
Check out Futon's source. That is about as canonical an example as you're
going to get.

On Tue, Sep 18, 2012 at 4:48 PM, john.tiger <jo...@gmail.com>wrote:

> On 09/18/2012 09:11 AM, Zera Holladay wrote:
>
>> Futon is built with jquery.couch.
>>
>
> okay so source should show examples - though this is a couchapp I believe
>
>  The resulting http request is listed as:
>>> PUT http://localhost:5984/_users/**org.couchdb.user%3Abob<http://localhost:5984/_users/org.couchdb.user%3Abob>
>>>
>>> but where is the actual username and password in the http request ?
>>>
>> In the body of the request.
>>
>
> okay, but this is missing (ie left for reader to figure out - which is
> difficult - we're trying to work thru all this but examples would make it
> easier
>
>
> I can accept that we might be missing something, but can anyone vouch
> that they actually have this working in a non couchapp app?
>
>
>  Yes.
>>
>
> any example ?  gist ?  snippet?
>
> thks
>
>
>
>
>


-- 
NS

Re: does jquery.couch actually work ?

Posted by "john.tiger" <jo...@gmail.com>.
On 09/18/2012 09:11 AM, Zera Holladay wrote:
> Futon is built with jquery.couch. 

okay so source should show examples - though this is a couchapp I believe
>> The resulting http request is listed as:
>> PUT http://localhost:5984/_users/org.couchdb.user%3Abob
>>
>> but where is the actual username and password in the http request ?
> In the body of the request.

okay, but this is missing (ie left for reader to figure out - which is 
difficult - we're trying to work thru all this but examples would make 
it easier

I can accept that we might be missing something, but can anyone vouch
that they actually have this working in a non couchapp app?


> Yes.

any example ?  gist ?  snippet?

thks





Re: does jquery.couch actually work ?

Posted by Zera Holladay <ze...@gmail.com>.
On Tue, Sep 18, 2012 at 10:52 AM, john.tiger <jo...@gmail.com> wrote:
> I believe no.  I have yet to see a working snippet of code where it runs
> without couchapp (and not even sure with couchapp )

Futon is built with jquery.couch.

> then there is broken documentation - take the Bradley Holt blog - nicely
> organized but not accurate.  Take the example of user signup.
> $.couch.signup(userDoc, "secretpassword"), {
>   success: ......
> }
>
> The resulting http request is listed as:
> PUT http://localhost:5984/_users/org.couchdb.user%3Abob
>
> but where is the actual username and password in the http request ?

In the body of the request.

> I can accept that we might be missing something, but can anyone vouch
> that they actually have this working in a non couchapp app?

Yes.

-zh