问题
A bit of a theoretical questions, although it comes from a real world problem when creating various objects in a single page app without immediately persisting them (see link below).
My question is whether local or unpersisted data can have a URL. I think it can, because at the time the object is created (not necessarily persisted) it does exist and thus can be navigated to. So, entering the URL for it should display it as long as the data is there. Back and Fwd buttons should also work. If you refresh the browser and enter the URL again, you will get a 404, which actually makes sense: "resource not (no longer) found".
The real world example here is that you should be able to enter a whole list of scores in a scorekeeping app and be able to navigate the individual scores before persisting them. EmberJS Fixtures are an example where new objects are never really written to disk but they are created and they do have URLs. So, in this case I'm talking about purely in-memory objects/resources, not local storage.
related question here
回答1:
I think a local data entity that was created, but isDirty
still, could have URL with any UUID, considering that only controller is really needed to route something like /flowers_tmp/:flowers_id
. Non-persisting data belongs to controller?
来源:https://stackoverflow.com/questions/15326308/can-local-or-transient-data-be-represented-by-urls