0

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?

Community
  • 1
  • 1
341008
  • 9,862
  • 11
  • 52
  • 84
  • 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

1 Answers1

0

Try to implement (ofc, w/o 'v1' in url) this.
Also found that. It should work since Padrino is the little bro of Sinatra.

Can't test for the moment. Please keep me aware !

Community
  • 1
  • 1
jgburet
  • 535
  • 3
  • 15