Closed lucas-santosP closed 1 year ago
You can add a plugin that listen to only one endpoint and override the url only for that endpoint :
client.use('get','/address/:zipcode', urlPlugin('https:://external-api.com')); //you still need to create the plugin
cf docs: http://www.zodios.org/docs/client/plugins#use-a-plugin-only-for-some-endpoints
would this answer your use case ?
and if you make the plugin, i would be happy to include it in @zodios/plugins
Great, I would be glad to do that. Should I open the PR on this repo or in zodios-plugins?
If you want to have it fast merged, it's better to create it for zodios-plugins. If not, you can create a PR here for v11 branch and it will be released as v11 beta release. Be carrefull, v11 branch is a monorepo with turbo repo and pnpm. You might have difficulties to set it up, if you are not familliar with monorepos.
thank you, it's now available on @zodios/plugins
v10.4.0
The use case for that is that sometimes you need to add an API call to external APIs with completely different base URL but its not complex enough to be worthy make another
ZodiosInstance
just for that one endpoint. So would be really neat if was possible to override thebaseUrl
in the endpoint definition, for example:Reading the issue #184 I saw that using plugins is possible to change the baseURL, but with my understanding it seems that would be really annoying to do that for each specific endpoint in this use case.
Thanks for your good work here, outstanding library!