I am writing a Padrino
app which will expose a few services via REST
apis. I need to version the apis. I found this answer which explains how to version an api such that the version is embedded in the uri. I would rather put my version info in the Accept
header or some other HTTP header (let's not go into the whole embed-in-uri vs put-in-header debate for now). Is there an idiomatic way of implementing this in a Padrino
controller? I would like to avoid littering version checks in all my routes. Is there any way I can put the check in a central place (DRY) or - better still - let Padrino
take care of this for me with some magical directives?
Asked
Active
Viewed 200 times
0
-
I've been searching for the same thing a time ago. Have you check body parameters ? You can join this with a `before` filter that will dispatch your queries. – jgburet Feb 25 '15 at 09:15