Hi Ingo, Thanks for helping me out like this. I will try later today. I some Ember Apps I have 40 routes like `post`, `authors` and `about` here. I will try to write a deploy plugin ( http://ember-cli.github.io/ember-cli-deploy/docs/v0.5.x/plugins/) so it could be generated. It would be better to support "pushState-on-CouchDB” for 40 routes. Perhaps a 404 rewrite rule?
- Martin On Sun, Oct 25, 2015 at 11:16 PM, Ingo Radatz <[email protected]> wrote: > Hi Martin, > > good news! - i have a local copy of your application up and running. Btw. > my fan is freaking out - some of our reloading code causes heavy load but > anyway - here is what you have to do: > > # 1st - to use the rewrite handler your root url is > > https://martinic.cloudant.com/bloggttest/_design/bloggrtest/_rewrite > > You can use your custom API from the rewrites.json in parallel with > CouchDB’s native API - but you must remember when is which API in use. > > > # 2nd - change the root URL in your index.html base-url meta tag > > <base href="/bloggttest/_design/bloggrtest/_rewrite/" /> > > > # 3th - extend the rewrites.json as follows > > [ > { > "from": "fonts/*", > "to": "fonts/*", > "method": "GET" > }, > { > "from": "assets/*", > "to": "assets/*", > "method": "GET" > }, > { > "from": "/", > "to": "index.html", > "method": "GET" > } > ] > > > Now, your app will start when you request > > https://martinic.cloudant.com/bloggttest/_design/bloggrtest/_rewrite/ > > in the browser. Your router forwards via pushState functionality to /posts > and i can choose particular posts like > /posts/7DFFB605-62CD-9D72-B376-5D3729E21904. > > And now i want to draw a line. Nothing of this enables > "pushState-on-CouchDB”. It would work also without the CouchDB rewrite > rules. But now comes the part where you want that to allow your readers to > bookmark a blog post e.g. > > > https://martinic.cloudant.com/bloggttest/_design/bloggrtest/_rewrite/posts/7DFFB605-62CD-9D72-B376-5D3729E21904 > > When they load this bookmark they will get: > > {"error":"not_found","reason":"missing”} > > Now you can add the following rule to the rewrites.json > > { > "from": “/posts/*", > "to": "index.html", > "method": "GET" > } > > It will always deliver the same index.html. Your ember router must know > the real root url and match to the route /posts/:id. The router have to act > the same way automatically in the initial load as i have manually by > clicking your blog post link. > > > Hope that helps. > Ingo > >
