3 ms·
We found that our API and web controllers were doing the exact same thing, so with rails we're just hitting the same endpoints but just using respond_to to diff
by aantix 13y ago
We found that our API and web controllers were doing the exact same thing, so with rails we're just hitting the same endpoints but just using respond_to to differentiate whether we respond with a jbuilder view (json) or standard HTML.
For the versioning, we developed VersionCake.
https://github.com/bwillis/versioncake/ https://github.com/bwillis/versioncake/
For each jbuilder view, the version number is contained within the file name. E.g.
index.json.v1.jbuilder
index.json.v2.jbuilder
index.json.v4.jbuilder
The client passes in a version number and VersionCake intelligently renders the appropriate view version or degrades to a prior version when the specified versioned view doesn't exist.
Works like a dream.
- jrnkntl 13y agoHappy user of VersionCake here! I am using it to support older versions of our iPhone apps while our backend can improve and expand without problems. Thanks for your work!