I'm attempting to make it so that top level-routing works from my Rails API to an Ember.js client in this manner (similar to how GitHub works, for example):
Hitting http://ift.tt/1gZKM9B
would give you a user's page. This would either hit the http://ift.tt/1O88r6E
endpoint or some other endpoint.
Hitting http://ift.tt/1YlepnM
would give you an organization's page. This would either hit the http://ift.tt/1O88r6G
endpoint or some other endpoint.
When getting a random URL, the client will obviously have no idea what type of model it's dealing with. It will just treat it as http://ift.tt/1YlepE0
, where random_string
is either a username
or an organization_name
.
I'm not quite sure how to deal with this situation. It's unclear where the responsibilities lie with client or server here. I can imagine maybe some sort of polymorphism working here, but can't connect the dots.
Aucun commentaire:
Enregistrer un commentaire