mercredi 24 juillet 2019

Axios returning 404 on laravel api request

ive a write a code to send a get request to server using vue js.but it return 404 not found exception thought the route is created on laravel.

enter image description here

axios.get('/api/v1/companies')
                .then(function (resp) {
                    app.companies = resp.data;
                })
                .catch(function (resp) {
                    console.log(resp);
                    alert("Could not load companies");
                });

route file :

Route::group(['prefix' => '/v1', 'namespace' => 'Api\V1', 'as' => 'api.', 'middleware' => 'auth:api'], function () {
    Route::resource('companies', 'CompaniesController', ['except' => ['create', 'edit']]);
});



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire