Hi I have an API in laravel 8. I am trying to access 'localhost:8000/test' and I get error "Symfony Component HttpKernel Exception NotFoundHttpException". I have the front in vue and I access axios.
Configuration axios in front 'utils/axios.js':
import axios from 'axios';
axios.defaults.baseURL = 'http://localhost:8000/';
axios.defaults.timeout = 18000;
export default axios;
Index.vue (from where the request is made):
import axios from '../utils/axios';
export default {
name: 'PageIndex',
methods: {
test() {
axios.get('test')
.then(() => {
console.log('ok');
})
.catch((error) => {
console.log(error);
});
},
},
};
File 'routes/api.php' from laravel:
<?php
use IlluminateSupportFacadesRoute;
Route::get('test', 'TestController@index');
I've tried both Route::get('test', 'TestController@index');
and Route::get('/test', 'TestController@index');
and it still doesn't work ...
I don't know what else to look at.
A greeting and thanks for the answers :)
question from:
https://stackoverflow.com/questions/65864472/laravel-error-8-symfony-component-httpkernel-exception-notfoundhttpexception 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…