Skip to content

Instantly share code, notes, and snippets.

@leafriend
Created March 18, 2019 17:12
Show Gist options
  • Select an option

  • Save leafriend/027185ef4d6b74a734ac576c0d3f31b2 to your computer and use it in GitHub Desktop.

Select an option

Save leafriend/027185ef4d6b74a734ac576c0d3f31b2 to your computer and use it in GitHub Desktop.
Client-side Load Balancing with Axios
import axios, { AxiosRequestConfig } from 'axios';
(async () => {
const config: AxiosRequestConfig = {
get baseURL() {
let baseURL = 'https://example.com';
// Select node here
return baseURL;
},
};
const response = await axios.get('/path/to/api', config);
console.log(response.data);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment