couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kevin R. Coombes" <>
Subject Re: HTML documentation within a couch application
Date Fri, 28 Sep 2012 16:58:43 GMT
Thanks for the suggestion; this works even when you access the page 
through a proxy.  You just have to set things up so that a jQuery 
"document ready" script can dynamically find and update all of the 
correct locations.

On 9/27/2012 1:06 PM, Octavian Damiean wrote:
> Hello Kevin,
> I can't tell if that'll work behind a proxy so you'll have to try it 
> out. In a normal environment you should get the hostname of the 
> invoking host using "window.location.hostname".
> Cheers,
> Octavian Damiean
> Am 27.09.2012 19:54, schrieb Kevin R. Coombes:
>> Hi,
>> I have now built several applications with CouchDB using a similar
>> structure.  They use CouchApp to maintain the directory structure, and
>> (in addition to the views, etc.) contain an _attachements folder that
>> includes:
>>      index.html (the main web-based user interface to the app)
>>      myapp.js (the main JavaScript code that is loaded by index.html to
>> do the work)
>>      docs.html (linked to from the main page to provide user 
>> documentation)
>> Part of the audience for the documentation includes statisticians and
>> bioinformaticians who I am trying to educate about how to write their
>> own programs to access the underlying data from the CouchDB database
>> directly (as a web service, not through this web site).  So I include
>> sample code that shows how to construct some of the URLs that they
>> need.  Not surprisingly (at least to anyone who reads this mailing
>> list), these all have the form
>>      http://MY.HOST.NAME/mydb/_design/whatever/blah
>> The question I have has to do with MY.HOST.NAME.  Right now, this is
>> hard-coded into the docs.html attachment.  I recognize that this is a
>> really dumb thing to do, especially  if I replicate this application to
>> another host. (I even recognize that in doing so I could also change the
>> databse name, but let's ignore that fact for now.)  I'm not sure of the
>> best way to handle this, which is why I am posting this message.
>> QUESTION: What is the best way to get the "MY.HOST.NAME" part inside the
>> docs.html file to be generated automatically from the host on which the
>> database is being served?
>> Oh, and just to complicate things, you should assume the actual couch
>> server is sitting behind a proxy, and I probably don't want the internal
>> host name to percolate out into the public documentation. In that
>> situation, I would want docs.html to show the name of the proxy server
>> instead.
>> Thanks in advance for your help,
>>      Kevin

View raw message