couchdbcouchapp

How do you configure CouchDB vhosts to point to rewrites in design doc


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 app/index.html attachment is absolutely there. I can see it. The app runs fine if I disable rewrites and use the ugly urls. 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?!?!?!....

Followup...

Ok following Marek's advice and setting my rewrites.json file to this...

[
    { "from": "home", "to": "app/index.html" },
    { "from": "lib/*", "to": "app/lib/*" },
    { "from": "js/*", "to": "app/js/*" },
    { "from": "css/*", "to": "app/css/*" },
    { "from": "img/*", "to": "app/img/*" }
]

It's almost there. It's starting to come together now thanks to your help :-)


Solution

  • I believe you configured your vhost wrong. It should be:

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