can local or transient data be represented by URLs?

烂漫一生 提交于 2019-12-25 14:47:33

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!