API Versioning for Rails Routes

前端 未结 7 701
独厮守ぢ
独厮守ぢ 2020-12-04 04:12

I\'m trying to version my API like Stripe has. Below is given the latest API version is 2.

/api/users returns a 301 to /api/v2/users

<
7条回答
  •  情深已故
    2020-12-04 04:49

    I'm not sure why you want to redirect to a specific version if a version isn't explicitly requested. Seems like you simply want to define a default version that gets served up if no version is explicitly requested. I also agree with David Bock that keeping versions out of the URL structure is a cleaner way to support versioning.

    Shameless plug: Versionist supports these use cases (and more).

    https://github.com/bploetz/versionist

提交回复
热议问题