also models and controllers and etc. Now we have an API with versions like v1, v2, v3 etc. What pattern and design we can have to be able to switch to lower version if an Api route hitting a method, fails. I mean how to change the controller from v3 to v2 when a specific requested method doesn't exist in our v3 controller?
Example: We have posts entity with two endpoints: index, show. We have each version of Api with their own PostController. Now we hit /api/v3/post/21 and assume that the controller of v3 doesn't have any method named "show". How can we use lower version's "show" method in that case? Plus, this should be automatic and if no lower controller had it, it should return 404
Обсуждают сегодня