Created
March 18, 2019 17:12
-
-
Save leafriend/027185ef4d6b74a734ac576c0d3f31b2 to your computer and use it in GitHub Desktop.
Client-side Load Balancing with Axios
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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