Reputation: 132
Can't seem to find this anywhere...
Is it possible for Axios calls within Nuxt to be called with automatic relative paths?
To state the case more specifically, I'd like to be able to not have to set a server-side API (express serverMiddleware) base URL specifically, but make it update for:
Would appreciate any help.
Thanks!
Upvotes: 1
Views: 1746
Reputation: 576
Just add this to your nuxt.config.js
axios: {
baseURL: '/api/',
},
and this will use relative directory api/:
Upvotes: 3