Skip to content

RTK Query: baseUrl, scaling, and microservices #3317

Answered by EskiMojo14
azangru asked this question in Q&A
Discussion options

You must be logged in to vote

Example 1

I would set baseUrl to '/api'. You'd then have separate endpoints with '/service-one' and '/service-two'.

Example 2

It depends on how related the data returned might be. The main reason you'd want to have as few API instances as possible is that you can't use providesTags and invalidatesTags for automated refetching between API instances - it only applies for the given endpoint's API slice. There are of course also (mild) performance concerns when you have more API instances, since that's more middleware to run and more reducers.

You can provide a full URL (e.g. 'https://service-one/api') for a given endpoint, and baseUrl will not be used (joinUrls, isAbsoluteUrl). You can use t…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by EskiMojo14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants