简体   繁体   English

在 url 中保留版本号是处理 url 多个版本的最佳方法吗?

[英]Is keeping version number in url a best way to handle multiple versions of url?

We are adding version in the url for making our application backward compatible.我们正在 url 中添加版本,以使我们的应用程序向后兼容。

We have an url version: {mysite}.com/v1/author/id我们有一个 url 版本: {mysite}.com/v1/author/id

May be in the next version of the app we may use something like this - {mysite}.com/v2/contributors/author/id可能在应用程序的下一个版本中,我们可能会使用这样的东西 - {mysite}.com/v2/contributors/author/id

In order to support old url format in the new app, we are adding version in the url.为了在新应用中支持旧的 url 格式,我们在 url 中添加版本。 By using the version in the path, we will know the url format and handle accordingly.通过使用路径中的版本,我们将知道 url 格式并进行相应处理。

Is this the best way to do this or is there any other recommend approach for this?这是最好的方法还是有其他推荐的方法?

I prefer React Router(Navigate to specific file/folders) on the version differentiation, if your both version is managed in same repository.如果您的两个版本都在同一个存储库中管理,我更喜欢版本差异化的 React Router(导航到特定文件/文件夹)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM