I am using axios
a get method. I also have set CORS
header, but it keeps giving me error saying Cross-Origin Request Blocked
.
Vue.js2:
methods: {
getSliderData () {
axios
.get('/sliders', {
headers: {
'Content-Type': 'Application/json',
'Access-Control-Allow-Origin': '*'
}
})
.then(res => {
console.log(res)
})
.catch(err => {
console.log(err)
})
}
}
Error: Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://localhost:3000/api/sliders. (Reason: CORS request did not succeed).