在 express 中使用 /api/v1/(whatever route here) 有什么意义?

What is the point of using /api/v1/(whatever route here) in express?

我已经制作 API 大约一年了,我被教导使用 http://IPAddress:Port/api/v1 all the time when building an API with express.js. Is there a specific reason I would want to do that? Is this just denoting that the API is in development? Ive recently changed my API to not run on port 3000 so that I am able to just say http://IPAddress.com/ instead of http://IPAddress.com:3000/api/v1 并且它以新的方式工作得很好。

对 API 进行版本控制的一个主要原因是 API 可以改进,但这样做可能会导致重大更改(例如,它可能不适用于应用程序正在使用 API 因为端点已被修改)。

因此,解决此问题的方法是让当前 API (v1) 的消费者继续使用它,直到他们想要切换,并为新消费者发布更新版本 (v2)。

这里有一些关于它的更多信息:https://restfulapi.net/versioning/