Quantcast
Channel: Active questions tagged config - Stack Overflow
Viewing all articles
Browse latest Browse all 5054

Why is my vue.config.js proxy not working?

$
0
0

I have a vue cli 3.5.0 project and am trying to add a proxy, but i cant get it to work. the server runs on :5000 and the client on :8080. Below you can see my proxy. But it keeps using :8080 instead of :5000

vue.config.js

module.exports = {    devServer: {      proxy: {'/api': {          target: 'http://localhost:5000',          ws: true,          changeOrigin: true        }      }    }  }

And this is an example of how I call a request

const url = '/api/races/'const config = {    headers: {'Authorization': "Bearer "+ localStorage.token}}class RaceService {    // Get Races    static getRaces() {        return new Promise(async (resolve, reject) => {            try {                const res = await axios.get(url)                const races = res.data                resolve(races)            } catch (err) {                reject(err)            }        })    }}

Can someone maybe help me? the api requests need to use :5000 instead of :8080


Viewing all articles
Browse latest Browse all 5054

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>