Let’s say we have a Node.js backend server running on localhost:4040. To ensure it is proxyed in and accessible from the components, we can configure the vue.config.js file and include a devServer section as shown below:
In the vue.config.js file:
module.exports: {
devServer: {
proxy: {
‘/api’: {
target: ‘http://localhost:4040/api’,
changeOrigin: true
}
}
}
}