vendredi 4 septembre 2015

Handling longer URLs with "nested" controllers

I am creating a single-page web application (SPA) which needs to display nested resources on the front-end, and I am not sure how sophisticated front-ends deal with long URLs. By nested resources, I mean pages that display specific content. I assume longer URLs are necessary to access resources that depend on multiple input values, like multiple ids, etc.

for example, we might access a simple resource (a page) like this on the front-end

:controller/:action/:id

but what if we need more data to determine what to display? would it become something like this:

my-app.com#controller1/action1/33/controller2/action6/14/controller3/action4/3347

or whatever

how does the front-end use URL conventions to access front-end resources (pages)? I am sure Rails has a way to do this, but I have never used Rails.

is there more a general way do this with vanilla JS? How do frameworks like Angular or Ember solve this problem?

perhaps we can use query params? One caveat is that this is a single page application, so all the parameters will be only interpreted by the front-end, because the parameters come after a hash, like so:

http://ift.tt/1VDIqO3

Aucun commentaire:

Enregistrer un commentaire