Versions of one web application on one page? (Query string)

I have a single page application with some static routes, for example:

example.org/#!/tools/ example.org/#!/stories/story-1/ 

These are examples of routes that do not need version control. Either the "page" exists, it is redirected, or it is missing.

But then I have other resources that I would like to use for the version (because they can have internal states, indicated by about 10 parameters):

example.org/#!/tools/population-tool/+ ? a = b & c = d [...]

Since querystring parameters can change over time (because the tool can resolve more parameters), I would like to add a version parameter to these "pages":

example.org/#!/tools/population-tool/+? v = 1.1 & a = b & c = d [...]

Thus, when the user navigates to the URL without any parameters, the default state and version are automatically added:

 example.org/#!/tools/population-tool/ => example.org/#!/tools/population-tool/ + version + default state 

In case the user decides to share / mark this URL, the paramater parameter will always allow me to reassign the parameters from one version to another.

  • Can you suggest a better approach?
  • Perhaps the version should be part of the URL for all routes?

    example.org/#!/ v1 / tools / population tool /

  • Or maybe query verification is the wrong approach at all? Perhaps I should have a method that has the right "API" based on the specified parameters?

Thanks.

+1
source share
1 answer

Guessing the correct API from the parameters can be tedious and lead to unnecessary difficulties in your routing subsystem. It is much cleaner to have version information clearly indicated in the URL.

Now, whether the approach to be followed, 1 or 2, is a matter of taste. In my opinion, it depends on how perceived your version of the application is for the end user. If your end user does not perceive the changes in the interface (i.e. if you follow the MVC architecture, and the change is only a model level, while the presentation level remains unchanged, it is recommended to approach approach 1 more closely. Where, as if it were important so that the user knows which version he is using, or if the user interface visible to the end user is different from different versions, then approach 2 is the best option as it puts the version information in a prominent position e in the url.

Another way to look at it may be to ask if the state of the application is different between versions. The URL (without request parameters) represents the state of the application, and if the answer is correct, the second approach should be used. However, if the version information is abstracted from the main application code and applies only to some abstracted subsections, for example. only a few classes of models should be followed, we come to 1.

0
source

Source: https://habr.com/ru/post/1415116/


All Articles