dingo / api

A RESTful API package for the Laravel and Lumen frameworks.
BSD 3-Clause "New" or "Revised" License
9.33k stars 1.25k forks source link

Target [Dingo\Api\Contract\Routing\Adapter] is not instantiable while building [Dingo\Api\Routing\Router] in Laravel 5.4 #1512

Open tankhit opened 6 years ago

tankhit commented 6 years ago

I have installed Dingo api version of

"dingo/api": "2.0.0-alpha1"

Installed successful but after execute the following artisan command

php artisan vendor:publish --provider="Dingo\Api\Provider\LaravelServiceProvider"

but it's not generate the api.php file in config folder. after that I'm going to define route file as following

$api = app('Dingo\Api\Routing\Router');

$api->version('v1', function ($api) {
    $api->group(['middleware' => ['api']], function($api) {
        $api->get('test', 'App\Api\Controllers\APIController@test');
    });
});

Once I hit the url http://localhost/restful_api/api/test it's return exception

(1/1) BindingResolutionException Target [Dingo\Api\Contract\Routing\Adapter] is not instantiable while building [Dingo\Api\Routing\Router].

Please help me for the same. I have follow step byhttps://github.com/dingo

Thank you

north9527 commented 6 years ago

Open config/app.php and register the required service provider above your application providers. Dingo\Api\Provider\LaravelServiceProvider::class

tankhit commented 6 years ago

I have added in config/app.php file but not generation api.php file inside the config/ folder

russik2013 commented 6 years ago

run Application cache cleared! Compiled views cleared! Route cache cleared! Configuration cache cleared! Configuration cached successfully! Generating autoload files Commands