0👍
If you are running from same origin, it shouldn’t be a problem. I suspect that you are running Vue app through npm run serve, then pointing it at the back end server, which is running in a different server.
Try creating directory in your backend called public. In Vue, run npm run build
and then take the minified files and place them in the public directory.
Then give access to it in node, using express:
app.use(express.static(path.join(__dirname, 'public')));
0👍
the problem might be that instead of
axios.post('http://0.0.0.0:5000/auth/login', {
username: this.username,
password: this.password
})
try using http://0.0.0.0:5000/auth/login/
I used to have preflight error also on mozilla and other browsers if it’s not slashed at the end. May i know what’s the exact CORS error you are having?
- [Vuejs]-Rails: Is it possible to assign PostgreSQL database entries to Vue in Rails?
- [Vuejs]-How to get uri address of a nested resources using vue js and laravel
Source:stackexchange.com