couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Broerse <i...@martinbroerse.com>
Subject Re: pushState in CouchDB for Ember
Date Sun, 25 Oct 2015 13:25:52 GMT
Hi Ingo,

I am setting my first steps here. Do I have to activate rewrite rules for
it is not working yet.

https://martinic.cloudant.com/bloggttest/_design/bloggrtest/
https://martinic.cloudant.com/bloggttest/_design/bloggrtest/index.html

When they start working do I need rules to exclude:
*https://martinic.cloudant.com/bloggttest/_design/bloggrtest/crossdomain.xml
<https://martinic.cloudant.com/bloggttest/_design/bloggrtest/crossdomain.xml>*
https://martinic.cloudant.com/bloggttest/_design/bloggrtest/assets/*
https://martinic.cloudant.com/bloggttest/_design/bloggrtest/fonts/*

Thanks,

- Martin

On Mon, Oct 19, 2015 at 7:51 PM, Martin Broerse <info@martinbroerse.com>
wrote:

> Hi Ingo,
>
> I will try it and report back, Thanks.
>
> - Martin
>
> On Mon, Oct 19, 2015 at 5:57 PM, Ingo Radatz <thewhorn@googlemail.com>
> wrote:
>
>> Hi Martin!
>>
>> pushState is a client-side feature and has no requirements on the
>> server-side. Period.
>>
>> I think what all the server-side related configurations want to enable is
>> the following:
>>
>> > Unfortunately if a user bookmarks or refresh a page on an app that’s
>> using HTML5 pushstate,
>> > it makes a request to the server for that deep linked content.
>> > Here are the rewrites for [put our preferred server into - lets say
>> CouchDB] to internally redirect that call
>> > to the same html file. Browser thinks its a unique page but it’s the
>> same.
>>
>> In other words: If you want to allow deep-linking (e.g. for bookmarks)
>> you have to respond any request with always the same index.html. One of the
>> first things you have to do when your JavaScript code executes is to
>> analyse the current path in the address bar and change the state of our
>> webapp accordingly (e.g. you trigger a route in our client-side router).
>>
>> How could you do that with a CouchDB rewrite handler?
>>
>> Just introduce a fetch-all rule to the rewrite.json
>>
>> [{
>>   “from”: “*”
>>   “to”: “index.html”,
>>   “method”: “GET"
>> }]
>>
>> The rule assumes you have the index.html attached to the same ddoc the
>> rewrite.json is included. If its attached to a different doc you can go to
>> the resource like
>>
>> [{
>>   “from”: “*”
>>   “to”: “../../other_doc_id/index.html”,
>>   “method”: “GET"
>> }]
>>
>> Hope that helps, ingo
>>
>> > On 19 Oct 2015, at 11:21, Martin Broerse <info@martinbroerse.com>
>> wrote:
>> >
>> > Hi Ingo,
>> >
>> > To get pushState to work clientside with for example Apache as a server
>> you have to something like this.
>> >
>> > https://github.com/broerse/ember-cli-blog/blob/master/public/.htaccess
>> >
>> > Are you saying pushState works out of the box? Then I like to rephrase
>> my question to "How do I write a rewriterule to support pushState?"
>> >
>> > - Martin
>> >
>> >
>> > On Mon, Oct 19, 2015 at 10:33 AM, Ingo Radatz <thewhorn@googlemail.com>
>> wrote:
>> > Hi Martin
>> >
>> > > I can't seem to find CouchDB documentation on pushState
>> > > so pointers are welcome.
>> >
>> > Hm. You talking about a client-side related functionality of the
>> browsers. So maybe it isn’t surprising that you cannot find anything about
>> it in a server-side related documentation. The client-side part of a
>> Couchapp are just the static resources (HTML/CSS/IMG/FONTS/…) that are
>> attached to a doc (mostly a ddoc). Which brings us to the next statement:
>> >
>> > > I think it is time to move my index.html file and .js files to
>> CouchDB.
>> >
>> > Attach them to any doc you want. Some uses a ddoc, others a normal doc.
>> If you want to access your index.html (perhaps with rewrite rules) you have
>> to know the _id of the doc you have attached to - so, i would recommend to
>> not using a UUID for this doc.
>> >
>> > Ingo
>> >
>>
>>
>

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