incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Deibert <mark.deib...@gmail.com>
Subject Re: Having troubles with rewrites
Date Tue, 08 Oct 2013 00:01:07 GMT
Ok so now I've added a rewrites.js file to my Couchapp root folder. In this
js file I have...

[
   {
       "method": "GET",
       "from": "/home",
       "to": "app/index.html",
   }
]


Now when I push the Couchapp, in CouchDB in my _design/rednecks I see it's
creating a "rewrites" property with the above js. So this looks all good to
me. This is how to do this right?

I changed my local.ini vhost to...

[vhosts]
rnr.couchdb:5984 = /rednecks/_design/rednecks


In Chrome I enter url...

http://rnr.couchdb:5984/home

I get same error...

{"error":"not_found","reason":"Document is missing attachment"}


That index.html attachment is absolutely there. I can see it. The app
runs fine if I disable this rewrite garbage. I've tried every
variation of the "to" string that I can think of and all I see is that
same error above.

Does _anyone_ know how to do this?!?!?!....




On Mon, Oct 7, 2013 at 6:47 PM, Mark Deibert <mark.deibert@gmail.com> wrote:

> I have Couchapp. It's working fine. Today, sadly, I decided to try
> rewrites. I'm having a good bit of trouble with this. Docs offer very
> minimal help. Not sure where my gears are stuck.
>
> Here is my local.ini vhosts entry...
>
> [vhosts]
> rnr.couchdb:5984 = /rednecks/_design/_rewrites
>
>
> I created a _design/_rewrites doc in the rednecks db. Here is it's
> content...
>
> {
>    "_id": "_design/_rewrites",
>    "_rev": "8-1cd78f53e0b21331bc9f9d8d33d1725b",
>    "rewrites": [
>        {
>            "from": "home",
>            "to": "/_design/rednecks/app/index.html",
>            "method": "GET",
>            "query": {
>            }
>        }
>    ]
> }
>
>
> In Chrome I enter http://rnr.couchdb:5984/home and I get this error...
> {"error":"not_found","reason":"Document is missing attachment"}
>
>
> It seems to me that the "to" in the rewrite is not finding the design doc and it's attachment.
That doc definitely does exist because the app runs great if I turn off the rewrite and just
enter the full ugly path.
>
> The _design/rednecks and the _design/_rewrites docs are in the same path/folder in Couch.
The info in docs.couchdb.org, section 3.7 is very light. It doesn't even mention how the "to"
path is figured. From what path does it start? No mention of that. Nice docs. In the CouchDB
Wiki, they've cut/pasted the same documentation and added almost zero additional info. Someone
did attempt to add the "to" path info at the bottom, but it's not really English that I can
understand. So that's not helpful.
>
> So... I'm hoping someone here can help me get unstuck :-)
>
> Thanks for any advice,
>
> Mark
>
>
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message