Versioning
It's quite easy to setup versioning for your app.
At first, you need to set the current version of your API and what type of versioning you prefer. This can either be
uri
orheader
.const app = new cheetah({ versioning: { current: 'v4', type: 'uri' } })
To access the version the client requested, you can use the
c.req.gateway
variable.app.get('/', c => { const gateway = c.req.gateway // e.g. v3 })
You can also specify a version range by passing a
gateway
option to the route.app.get('/', { gateway: '>= v3' }, c => { const gateway = c.req.gateway // either v3 or v4 })