Install Dingo in Laravel 5.2 and get error when ca

2019-08-08 21:13发布

I have install the Dingo with composer, and change the app.php file. After configure the app.php file, then i have publish vendor that, and get the api.php file.

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

$api->version('v1', ['namespace' => 'App\Http\Controllers'], function ($api) {
    $api->get('users', 'EventsController@index');
});

Then i try php artisan api:routes

This is my result:

+----------------+----------------+------+---------+-----------+------------+----------+
| Host           | URI            | Name | Action  | Protected | Version(s) | Scope(s) |
+----------------+----------------+------+---------+-----------+------------+----------+
| api.kayice.com | GET|HEAD users |      | Closure | No        | v1         |          |
+----------------+----------------+------+---------+-----------+------------+----------+

Then i php artisan serve go to localhost:8000/user
It just show me this Sorry, the page you are looking for could not be found. Could that anything is might miss for that?


Edited
I have added the provider in the app.php, i think after the vendor publish, the api working, then everythings should working. Or else is the laravel 5.2 problem?

标签: php rest laravel
1条回答
唯我独甜
2楼-- · 2019-08-08 22:01

I figure out what is the problem now, i didnt add the prefix in the api.php. Therefore it didnt return me the value.
Edited
But it still does not, most probably the system still no yet support well

查看更多
登录 后发表回答