[Vuejs]-Vuejs proxy not working with webpack template

0👍

✅

You need to enable CORS in your express application as follows

Install CORS package from npm

$ npm install cors

Enable in your express application like below code

var express = require('express')
var cors = require('cors')
var app = express()

app.use(cors())

app.get('/api/message', function (req, res, next) {
  res.json({msg: 'This is CORS-enabled for all origins!'})
})

For more information to customize cors package as your need, refer https://github.com/expressjs/cors

Leave a comment