Given a snippet of code following standard approach to set a controller.
@Get('/first')
getAll() {
// Some logic here!
}
This can be accessed by /api/products/first
Can we create a decorator that can do the following?
@Version(2)
@Get('/first')
getAll() {
// Some logic here!
}
Now I should be able to access this through /api/products/v2/first
Or
@Version([1,2])
@Get('/first')
getAll() {
// Some logic here!
}
@Version([3])
@Get('/first')
getAllv3() {
// Some logic here!
}
Allowing usage of /api/products/v1/first, /api/products/v2/first and /api/products/v3/first.
Tried using SetMetaData but that how to edit a route that is already defined or to be defined.
I am stuck. Please Help.
Thanks!