1๐
โ
I am using axios as HTTP client for making api calls, I have created a gateways
folder in my src
folder and I have put files for each backend, creating axios instances, like following
myApi.js
import axios from 'axios'
export default axios.create({
baseURL: 'http://localhost:3000/api/v1',
timeout: 5000,
headers: {
'X-Auth-Token': 'f2b6637ddf355a476918940289c0be016a4fe99e3b69c83d',
'Content-Type': 'application/json'
}
})
You can look at detailed answer related to this here and here.
๐คSaurabh
1๐
Yes, as a separate file that you call from your page:
https://github.com/pagekit/vue-resource
๐คNelson Rodriguez
Source:stackexchange.com