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/08/14 19:34:05 UTC

html5 to couchdb without couchapp

since couch is REST it should be ideal for html5 jquery mobile apps but 
I cannot find any articles or tutorials that don't use couchapp (which 
we don't want to use)  - looking for best way to integrate with jquery 
mobile api (ie should REST calls be done under pageinit ?  .... anytime 
? ....

and also best way to work in security (auth/auth) with jquery mobile.

any good sources ?  thks.

Re: html5 to couchdb without couchapp

Posted by Zera Holladay <ze...@gmail.com>.
Futon and couchapp use a really nice library built on top of jquery
called jquery.couch.  You can make ajax calls whenever, it doesn't
have to be from pageinit.

Server side, you use validate_doc_update.

-zh

On Tue, Aug 14, 2012 at 1:34 PM, john.tiger <jo...@gmail.com> wrote:
> since couch is REST it should be ideal for html5 jquery mobile apps but I
> cannot find any articles or tutorials that don't use couchapp (which we
> don't want to use)  - looking for best way to integrate with jquery mobile
> api (ie should REST calls be done under pageinit ?  .... anytime ? ....
>
> and also best way to work in security (auth/auth) with jquery mobile.
>
> any good sources ?  thks.

Re: html5 to couchdb without couchapp

Posted by "john.tiger" <jo...@gmail.com>.
thks for the info - I'll look over jquery.couch this weekend - sounds 
like the right approach.

On 08/15/2012 08:18 PM, Wordit wrote:
> @john, I took the same approach, just html/css/javascript, without
> making a couchapp.
>
> Especially now that I want to port the app to a browser extension and
> PhoneGap for Android, it was the right choice for me to use "plain"
> html/css/javascript. That makes the app very portable.
>
> I would recommend jquery.couch. That has all the extras you need to
> build couch apps. Documentation for the javascript libraries are on
> GitHub, and somebody else wrote a blog post with examples for each
> method (Google for that).
>
> Authentication also works via the javascript libraries once the user
> has been setup. You could install the plugins into your couch for
> BrowserID/Twitter/Facebook for user registration (GitHub). Or use a
> server-side script of your own for user registration and
> authentication. There are PHP, Ruby, Node etc libraries.
>
> HTH,
>
> Marcus
>


Re: html5 to couchdb without couchapp

Posted by Wordit <wo...@gmail.com>.
@john, I took the same approach, just html/css/javascript, without
making a couchapp.

Especially now that I want to port the app to a browser extension and
PhoneGap for Android, it was the right choice for me to use "plain"
html/css/javascript. That makes the app very portable.

I would recommend jquery.couch. That has all the extras you need to
build couch apps. Documentation for the javascript libraries are on
GitHub, and somebody else wrote a blog post with examples for each
method (Google for that).

Authentication also works via the javascript libraries once the user
has been setup. You could install the plugins into your couch for
BrowserID/Twitter/Facebook for user registration (GitHub). Or use a
server-side script of your own for user registration and
authentication. There are PHP, Ruby, Node etc libraries.

HTH,

Marcus

Re: html5 to couchdb without couchapp

Posted by Sean Copenhaver <se...@gmail.com>.
Interfacing with CouchDB is nothing special form a client. CouchDB is
literally a web server (embeds MochiWeb) that does REST style requests with
JSON. It has a few special APIs (_replicate, _changes, _design, _bulk_docs)
and the concept of a design document that are special to it.

You can easily interact with CouchDB using jquery AJAX api (my preferred
way for browser side generally) or even XHR. There really isn't anything
special on that front. If you are hiding it behind or interfacing with a
bit of node.js (which can aid in auth/auth control) then nano [1] is quite
nice to work with. But basically you just need an HTTP library.

As for the not wanting your app as a couchapp, I'm going to assuming you
just don't want to upload the attachments of static files over and over.
For local development it certainly means an extra step but for deploy to an
environment it really isn't that different. CouchDB can easily handle
serving them, but if you prefer something like node.js or nginx serving
them I can understand.

If you want any data transformation or views then you'll have to work with
a design document [2] and you'll most likely want to get familiar with one
of couchapp tools [3] which aids in building the document and posting it to
CouchDB.

[1]  https://github.com/dscape/nano
[2]  http://guide.couchdb.org/draft/design.html
[3]  http://couchapp.org/page/index


On Wed, Aug 15, 2012 at 1:25 PM, Octavian Damiean <ma...@gmail.com>wrote:

> Well, as with any technology you don't know,  take your time to get used to
> it and to fully understand it and then start using it.
> On Aug 15, 2012 7:13 PM, "john.tiger" <jo...@gmail.com> wrote:
>
> > On 08/15/2012 08:16 AM, Dale Harvey wrote:
> >
> >> You need to have a proxy so you can made requests from your site to the
> >> CouchDB via the same host, then everything 'just works'
> >>
> >
> > hmm, can you explain this a bit more  - obviously server-server calls
> > provide security - but where does the proxy fit in ?    we have been
> happy
> > using node-http-proxy (nodejs) on some apps.   jquery.couch seems to be
> > something we're looking for making the db calls - frankly, have not had
> the
> > time to look at it too closely yet - maybe this weekend
> >
> >
> >
> >
>



-- 
“The limits of language are the limits of one's world. “ - Ludwig von
Wittgenstein

"Water is fluid, soft and yielding. But water will wear away rock, which is
rigid and cannot yield. As a rule, whatever is fluid, soft and yielding
will overcome whatever is rigid and hard. This is another paradox: what is
soft is strong." - Lao-Tzu

Re: html5 to couchdb without couchapp

Posted by "john.tiger" <jo...@gmail.com>.
On 08/15/2012 11:25 AM, Octavian Damiean wrote:
> Well, as with any technology you don't know,  take your time to get used to
> it and to fully understand it and then start using it.

hey, I asked for some details not a stupid answer - that's the really 
big problem with the couch community - too much wasted time to get 
answers to getting things to work and implemented -  piss poor docs, no 
good how-tos, piss poor community help !!!




> On Aug 15, 2012 7:13 PM, "john.tiger"<jo...@gmail.com>  wrote:
>
>> On 08/15/2012 08:16 AM, Dale Harvey wrote:
>>
>>> You need to have a proxy so you can made requests from your site to the
>>> CouchDB via the same host, then everything 'just works'
>>>
>> hmm, can you explain this a bit more  - obviously server-server calls
>> provide security - but where does the proxy fit in ?    we have been happy
>> using node-http-proxy (nodejs) on some apps.   jquery.couch seems to be
>> something we're looking for making the db calls - frankly, have not had the
>> time to look at it too closely yet - maybe this weekend
>>
>>
>>
>>


Re: html5 to couchdb without couchapp

Posted by Zera Holladay <ze...@gmail.com>.
John,

I understand your thoughts on couchapps, but there are some advantages
so don't dismiss them outright.  Some advantages are:

1.  Naturally manage code, specifically views, in a directory structure.
2.  Easy deployment with .couchapprc.
3.  Bootstrap data with _docs/ for testing.

The major disadvantage is that there is no document level read
restrictions with pure couchapps, which is a deal breaker for a lot of
applications.  However, this doesn't invalidate any of the advantages
noted above.

If read-level access is a problem, then node-restify or express might
make a nice proxy or api.

If you're writing a cordova app with jQuery Mobile, then you might try
loading your static content locally and persisting data to couch with
ajax via mobileinit.

-zh

On Wed, Aug 15, 2012 at 1:25 PM, Octavian Damiean <ma...@gmail.com> wrote:
> Well, as with any technology you don't know,  take your time to get used to
> it and to fully understand it and then start using it.
> On Aug 15, 2012 7:13 PM, "john.tiger" <jo...@gmail.com> wrote:
>
>> On 08/15/2012 08:16 AM, Dale Harvey wrote:
>>
>>> You need to have a proxy so you can made requests from your site to the
>>> CouchDB via the same host, then everything 'just works'
>>>
>>
>> hmm, can you explain this a bit more  - obviously server-server calls
>> provide security - but where does the proxy fit in ?    we have been happy
>> using node-http-proxy (nodejs) on some apps.   jquery.couch seems to be
>> something we're looking for making the db calls - frankly, have not had the
>> time to look at it too closely yet - maybe this weekend
>>
>>
>>
>>

Re: html5 to couchdb without couchapp

Posted by Octavian Damiean <ma...@gmail.com>.
Well, as with any technology you don't know,  take your time to get used to
it and to fully understand it and then start using it.
On Aug 15, 2012 7:13 PM, "john.tiger" <jo...@gmail.com> wrote:

> On 08/15/2012 08:16 AM, Dale Harvey wrote:
>
>> You need to have a proxy so you can made requests from your site to the
>> CouchDB via the same host, then everything 'just works'
>>
>
> hmm, can you explain this a bit more  - obviously server-server calls
> provide security - but where does the proxy fit in ?    we have been happy
> using node-http-proxy (nodejs) on some apps.   jquery.couch seems to be
> something we're looking for making the db calls - frankly, have not had the
> time to look at it too closely yet - maybe this weekend
>
>
>
>

Re: html5 to couchdb without couchapp

Posted by "john.tiger" <jo...@gmail.com>.
On 08/15/2012 08:16 AM, Dale Harvey wrote:
> You need to have a proxy so you can made requests from your site to the
> CouchDB via the same host, then everything 'just works'

hmm, can you explain this a bit more  - obviously server-server calls 
provide security - but where does the proxy fit in ?    we have been 
happy using node-http-proxy (nodejs) on some apps.   jquery.couch seems 
to be something we're looking for making the db calls - frankly, have 
not had the time to look at it too closely yet - maybe this weekend




Re: html5 to couchdb without couchapp

Posted by Dale Harvey <da...@arandomurl.com>.
You need to have a proxy so you can made requests from your site to the
CouchDB via the same host, then everything 'just works'

On 14 August 2012 19:15, john.tiger <jo...@gmail.com> wrote:

> On 08/14/2012 12:09 PM, Aurélien Bénel wrote:
>
>> Hi John,
>>
>>  but I cannot find any articles or tutorials that don't use couchapp
>>> (which we don't want to use)
>>>
>>
>> I'm not sure about what do you mean by "not using couchapp"...
>>
> simple, we do not want our app (js, html, css files) contained and served
> by couchdb in a "couchapp"
>
>
>
>
>> "couchapp" means two things : a "couch application" and a developper tool.
>>
>> Even if you want to use CouchDB as just a database, you will probably
>> need views and couchapp is definitely a convenient tool to edit them...
>>
>>
>> Regards,
>>
>> Aurélien
>>
>>
>>
>

Re: html5 to couchdb without couchapp

Posted by "john.tiger" <jo...@gmail.com>.
On 08/15/2012 08:31 AM, Benoit Chesneau wrote:
> On Tuesday, August 14, 2012, john.tiger wrote:
>
>>
>> simple, we do not want our app (js, html, css files) contained and served
>> by couchdb in a "couchapp"
>>
>>
>>
> why?

I dont' want to argue but will give you our feedback - we spent a huge 
amount of time failing to get couchapp to work right for our needs - my 
personal feeling: editing is too complicated (is it the built in one, 
python, node, .... none seemed to work well for us), docs are too poor 
-> it's not catching on - needs a good todo list demo to match to other 
frameworks and provide a template for other apps.

ymmv but we can't afford more time with it.




Re: html5 to couchdb without couchapp

Posted by Benoit Chesneau <bc...@gmail.com>.
On Tuesday, August 14, 2012, john.tiger wrote:

> On 08/14/2012 12:09 PM, Aurélien Bénel wrote:
>
>> Hi John,
>>
>>  but I cannot find any articles or tutorials that don't use couchapp
>>> (which we don't want to use)
>>>
>>
>> I'm not sure about what do you mean by "not using couchapp"...
>>
> simple, we do not want our app (js, html, css files) contained and served
> by couchdb in a "couchapp"
>
>
>
why?

>
>> "couchapp" means two things : a "couch application" and a developper tool.
>>
>> Even if you want to use CouchDB as just a database, you will probably
>> need views and couchapp is definitely a convenient tool to edit them...
>>
>>
>> Regards,
>>
>> Aurélien
>>
>>
>>
>

Re: html5 to couchdb without couchapp

Posted by "john.tiger" <jo...@gmail.com>.
On 08/14/2012 12:09 PM, Aurélien Bénel wrote:
> Hi John,
>
>> but I cannot find any articles or tutorials that don't use couchapp (which we don't want to use)
>
> I'm not sure about what do you mean by "not using couchapp"...
simple, we do not want our app (js, html, css files) contained and 
served by couchdb in a "couchapp"


>
> "couchapp" means two things : a "couch application" and a developper tool.
>
> Even if you want to use CouchDB as just a database, you will probably need views and couchapp is definitely a convenient tool to edit them...
>
>
> Regards,
>
> Aurélien
>
>


Re: html5 to couchdb without couchapp

Posted by Aurélien Bénel <au...@utt.fr>.
Hi John,

> but I cannot find any articles or tutorials that don't use couchapp (which we don't want to use)


I'm not sure about what do you mean by "not using couchapp"...

"couchapp" means two things : a "couch application" and a developper tool.

Even if you want to use CouchDB as just a database, you will probably need views and couchapp is definitely a convenient tool to edit them... 


Regards,

Aurélien