-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support multiple api versions in a single loopback app #2483
Comments
@vasanthps-rm Would you like to submit a PR? Sounds like a good suggestion. @bajtos @raymondfeng Thoughts? |
@superkhau Sure. I will work on it! |
@vasanthps-rm 👍 Just ping me when you're done and I'll help review it. Good luck! 🍀 |
We are looking forward to have this feature 💪 |
+1 |
+1 |
any movement on this? |
Any update on this feature? |
+1 on this feature.
Then explicitly looking for that variable in the remoteMethods. |
@ako977 could you please elaborate on your versioning workaround? How do you support multiple versions? |
@joeybenenati sorry, I wasn't complete in my previous comment. I do the following: middleware.json:
In the above case, restApiRoot is the constant you define in config.json eg. Then in your model config.
The above will give you To grab this variable, you can add a boot script to retrieve it on every API call eg.
In your remoteMethod definitions you can explicitly request the apiVersion as a query param eg.
Incidentally, I use the above refactored into a utility function on all my remote method query param definitions. This way the utility function automatically adds the apiVersion as well as access token to all my param arguments.
It's my solution for the context plugin bugginess observed in loopback. You can then easily grab it in your remote method function:
|
@vasanthps-rm I just only create a new property (in my case baseRestApiRoot) in config*.js like this
and I modified the middleware.json in this way
and thats all |
Any update on this? |
@rikantro Can you please explain a bit more on what's happening here? |
Is that feature done? |
Curious to know if that is something planned to be implemented in Loopback v4? Or the only option is to use conditional logic like in @ako977's comment? It seems v3 supported adding version to REST API route, but it was just using the currently defined version of the API - still just one and only. |
Kindly add support to multiple api versions in a single loopback app.
For ex:-
In config.*.js, instead of
We could do
And for a model, say 'device.json', the corresponding js files can be 'device.v1.js' and 'device.v2.js', each file with api's for their respective versions. The acl's in the json file should have api versions included as well.
Suggestions and better way to implement this feature is also welcome
The text was updated successfully, but these errors were encountered: