As part of learning Vue3 I am trying to piece together code that will mock API calls using Axios and a local Json file. However I am getting a 404 when accessing the file and suspect the route is not setup correctly.
The data files are in my root folder and I have the following in the routes.json file in the root of the project
{
"/api/*": "/$1",
"/hero": "/heroes",
"/reset": "/reset"
}
I have no reference to the API in the router config (vueRouter) and not sure if needed?.
When I call the ../api/heros (file) I get redirected to my page not found handler.
{
path: "/:catchAll(.*)",
name: "NotFound",
component: PageNotFound,
meta: {
requiresAuth: false
}
},
I am not sure my routes.js
and router/index.js
affect each other?
Expectation: I can navigate to the JSON data in the browser and also use this in Axios