incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From J Chris Anderson <jch...@gmail.com>
Subject Re: including external javascript libs
Date Fri, 07 May 2010 20:25:03 GMT

On May 7, 2010, at 1:16 PM, Ryan Ramage wrote:

> Is there a way to 'install' javascript files on the server so they
> would be available to map/reduce functions? Can they be added to the
> directory /share/couchdb/server ?
> 

This doesn't work, because then if your application is replicated to a "standard" couch, it
breaks. The robust solution is to include all your JavaScript code in the design document.

Chris

> http://documentcloud.github.com/underscore/
> 
> Would be a handy library to have around.
> 
> Ryan
> 
> 
> On Sat, May 8, 2010 at 3:12 AM, erich oliphant <erich.oliphant@gmail.com> wrote:
>> Ok thanks for the clarification
>> 
>> On Fri, May 7, 2010 at 9:07 AM, Sebastian Cohnen <
>> sebastiancohnen@googlemail.com> wrote:
>> 
>>> the !code macro simply replaces itself with the content of the target. if
>>> you don't want to use couchapp, you have to insert your code yourself.
>>> "loading" from an external resource is not allowed since views wouldn't be
>>> side effect free (couch would not notice if the external code has been
>>> changed).
>>> 
>>> For loading code in show, list, update and validation functions you can use
>>> CommonJS-style modules (see
>>> http://wiki.apache.org/couchdb/CommonJS_Modules )
>>> 
>>> On 07.05.2010, at 14:43, erich oliphant wrote:
>>> 
>>>> Hi,
>>>> I am trying to figure out the best way to include js libs in my couch
>>>> show,view,etc functions.  I just realized the the examples in the couch
>>> book
>>>> with the !code and !json macros are specific to CouchApp.  For instance I
>>>> ned to parse some ISO 8601 dates, and have a little date.js script that
>>> I'd
>>>> like to include in my functions.
>>>> 
>>>> Thanks In Advance
>>>> 
>>>> --
>>>> Erich Oliphant
>>>> 
>>>> "There are, in fact, two things, science and opinion, the former begets
>>>> knowledge, the latter ignorance"
>>>> -- Hippocrates of Cos
>>> 
>>> 
>> 
>> 
>> --
>> Erich Oliphant
>> 
>> "There are, in fact, two things, science and opinion, the former begets
>> knowledge, the latter ignorance"
>> -- Hippocrates of Cos
>> 


Mime
View raw message