[Vuejs]-I am getting the error Vue warn]: Error in v-on handler (Promise/async): "Error: Request failed with status code 404"

0👍

As @Romalex already commented, you created an axios object with a base Url, but you don’t use it.

import axios from 'axios'

const api = axios.create({
   baseURL: 'http://localhost:3000/',
   headers: {
     "Content-Type": "application/json"
   }
});

export default api;

Give the object a name, export it, and use it in your application instead of the axios object

Example:

async getData() {
  return await api.get('/data/1');
}

Leave a comment