You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@couchdb.apache.org by Vlad GURDIGA <gu...@gmail.com> on 2009/07/21 18:30:10 UTC

couchjs vs. js

Hi,

I'm trying to put together some code and till now I was using js
(SpiderMonkey) to run Javascript code on the server. Now I see there
is a "couchjs" binary that is actually the one that is going to
execute the Javascript on CouchDB. The only documentation I found
about it is a man page on
http://manpages.ubuntu.com/manpages/intrepid/man1/couchjs.1.html.

Is there any significat difference between js and couchjs and if there
is where can I find any documentation about that?

Thank you!

Re: couchjs vs. js

Posted by Vlad GURDIGA <gu...@gmail.com>.
I have to apologize, again: I should have payed more attention to source code.

For those interested in answer to my question, that is information on
how to use the curl extension provided by couchjs, there is enough in
the test/test.js* file. One can use CouchDB.request method defined in
there to make HTTP calls.

Enjoy!


*http://svn.apache.org/viewvc/couchdb/trunk/test/test.js?view=co

Re: couchjs vs. js

Posted by Vlad GURDIGA <gu...@gmail.com>.
Thank you Jan!

On Thu, Jul 30, 2009 at 1:14 PM, Jan Lehnardt<ja...@apache.org> wrote:
> I could have sworn I replied to this earlier :)

I apologize, I'm here only a few months, this is why I could have missed it.

> On 30 Jul 2009, at 11:55, Vlad GURDIGA wrote:
>
>> There is a comment in trunk/test/test.js* stating:
>>
>> // This is a JS wrapper for the curl function made available in
>> couch_js.c,
>> // it should be used in other JavaScripts that would like to make HTTP
>> calls.
>>
>> and looking in trunk/src/couchdb/couch_js.c** we can see functions
>> like GetHttp, HeadHttp, PostHttp, PutHttp, DelHttp, CopyHttp, etc.
>>
>> Does this mean we can make HTTP calls from JS files? It would be
>> really handy for integration tests on the server-sde, but AFAIK,
>> SpiderMonkey (the js binary) dos not have any documented function to
>> make HTTP calls.
>>
>> This is why I suspect that there is additional functionality in
>> couchjs vs. js which we could use.
>>
>> Now, can somebody confirm or infirm this suspicion?
>
> couchjs is js + curl bindings for the test suite.

Great!

Now is that curl functionality documented anywhere else other than the
source code itself?

Re: couchjs vs. js

Posted by Jan Lehnardt <ja...@apache.org>.
I could have sworn I replied to this earlier :)


On 30 Jul 2009, at 11:55, Vlad GURDIGA wrote:

> There is a comment in trunk/test/test.js* stating:
>
> // This is a JS wrapper for the curl function made available in  
> couch_js.c,
> // it should be used in other JavaScripts that would like to make  
> HTTP calls.
>
> and looking in trunk/src/couchdb/couch_js.c** we can see functions
> like GetHttp, HeadHttp, PostHttp, PutHttp, DelHttp, CopyHttp, etc.
>
> Does this mean we can make HTTP calls from JS files? It would be
> really handy for integration tests on the server-sde, but AFAIK,
> SpiderMonkey (the js binary) dos not have any documented function to
> make HTTP calls.
>
> This is why I suspect that there is additional functionality in
> couchjs vs. js which we could use.
>
> Now, can somebody confirm or infirm this suspicion?

couchjs is js + curl bindings for the test suite.

Cheers
Jan
--


>
>
> Thank you!
>
>
> *http://svn.apache.org/viewvc/couchdb/trunk/test/test.js?revision=794057
> **http://svn.apache.org/viewvc/couchdb/trunk/src/couchdb/couch_js.c?revision=794057
>
>
> On Thu, Jul 30, 2009 at 11:12 AM, Nils Breunese<N....@vpro.nl>  
> wrote:
>> CouchDB just uses SpiderMonkey to run JavaScript, so your code  
>> should work just fine.
>>
>> Nils Breunese.
>> ________________________________________
>> Van: Vlad GURDIGA [gurdiga@gmail.com]
>> Verzonden: dinsdag 21 juli 2009 18:30
>> Aan: user@couchdb.apache.org
>> Onderwerp: couchjs vs. js
>>
>> Hi,
>>
>> I'm trying to put together some code and till now I was using js
>> (SpiderMonkey) to run Javascript code on the server. Now I see there
>> is a "couchjs" binary that is actually the one that is going to
>> execute the Javascript on CouchDB. The only documentation I found
>> about it is a man page on
>> http://manpages.ubuntu.com/manpages/intrepid/man1/couchjs.1.html.
>>
>> Is there any significat difference between js and couchjs and if  
>> there
>> is where can I find any documentation about that?
>>
>> Thank you!
>>
>> 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: couchjs vs. js

Posted by Vlad GURDIGA <gu...@gmail.com>.
There is a comment in trunk/test/test.js* stating:

// This is a JS wrapper for the curl function made available in couch_js.c,
// it should be used in other JavaScripts that would like to make HTTP calls.

and looking in trunk/src/couchdb/couch_js.c** we can see functions
like GetHttp, HeadHttp, PostHttp, PutHttp, DelHttp, CopyHttp, etc.

Does this mean we can make HTTP calls from JS files? It would be
really handy for integration tests on the server-sde, but AFAIK,
SpiderMonkey (the js binary) dos not have any documented function to
make HTTP calls.

This is why I suspect that there is additional functionality in
couchjs vs. js which we could use.

Now, can somebody confirm or infirm this suspicion?


Thank you!


*http://svn.apache.org/viewvc/couchdb/trunk/test/test.js?revision=794057
**http://svn.apache.org/viewvc/couchdb/trunk/src/couchdb/couch_js.c?revision=794057


On Thu, Jul 30, 2009 at 11:12 AM, Nils Breunese<N....@vpro.nl> wrote:
> CouchDB just uses SpiderMonkey to run JavaScript, so your code should work just fine.
>
> Nils Breunese.
> ________________________________________
> Van: Vlad GURDIGA [gurdiga@gmail.com]
> Verzonden: dinsdag 21 juli 2009 18:30
> Aan: user@couchdb.apache.org
> Onderwerp: couchjs vs. js
>
> Hi,
>
> I'm trying to put together some code and till now I was using js
> (SpiderMonkey) to run Javascript code on the server. Now I see there
> is a "couchjs" binary that is actually the one that is going to
> execute the Javascript on CouchDB. The only documentation I found
> about it is a man page on
> http://manpages.ubuntu.com/manpages/intrepid/man1/couchjs.1.html.
>
> Is there any significat difference between js and couchjs and if there
> is where can I find any documentation about that?
>
> Thank you!
>
> 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: couchjs vs. js

Posted by Nils Breunese <N....@vpro.nl>.
CouchDB just uses SpiderMonkey to run JavaScript, so your code should work just fine.

Nils Breunese.
________________________________________
Van: Vlad GURDIGA [gurdiga@gmail.com]
Verzonden: dinsdag 21 juli 2009 18:30
Aan: user@couchdb.apache.org
Onderwerp: couchjs vs. js

Hi,

I'm trying to put together some code and till now I was using js
(SpiderMonkey) to run Javascript code on the server. Now I see there
is a "couchjs" binary that is actually the one that is going to
execute the Javascript on CouchDB. The only documentation I found
about it is a man page on
http://manpages.ubuntu.com/manpages/intrepid/man1/couchjs.1.html.

Is there any significat difference between js and couchjs and if there
is where can I find any documentation about that?

Thank you!

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.