incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Wordit <wordi...@gmail.com>
Subject Re: Passing parameters in simple URLs
Date Wed, 20 Feb 2013 00:51:41 GMT
Benoit,

I tried your suggestion but it doesn't seem to be working or am I
entering the wrong URL? The home url is: .../_design/mydb/index.html

When I query: .../_design/mydb/a/b
I get: {"error":"not_found","reason":"Document is missing attachment"}

My goal is to generate simple urls for users instead of server-side
params with: ?foo=a&bar=b

Thanks,

Marcus



On Sat, Feb 9, 2013 at 8:44 AM, Benoit Chesneau <bchesneau@gmail.com> wrote:
> On Feb 9, 2013 6:21 AM, "Wordit" <wordituk@gmail.com> wrote:
>>
>> I'd like to pass a few parameters via an app's url without using the
>> server-side style "?param1=a&param2=b".
>> Instead, I'd like to use segments like this
>> "../database/index.html/a/b". I tried adding a hashtag
>> ".../index.html/#/a/b", but couchdb didn't like that at all.
>>
>> I can process the url with javascript. Where I'm stuck is preventing
>> couchdb from processing the url after the index.html section.
>>
>> What alternatives are there to pass params in simple urls? Are there
>> any rewrite rules which may help?
>>
>> Thanks,
>>
>> Marcus
> Not sure if it's what you want but you can use a rewrite rule:
>
> {"from": "/:a/:b/", "to": "index.html"}
>
> a and b will be passed as query parameters to the index  while the user
> will query /a/b.
>
> - benoƮt

Mime
View raw message