在Laravel 5.2中安装Dingo并在调用api时出错
我已经使用composer安装了Dingo,并更改了app.php文件.配置app.php文件后,然后我已发布了该供应商,并获得了api.php文件.
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');
});
然后我尝试php artisan api:routes
这是我的结果:
+----------------+----------------+------+---------+-----------+------------+----------+
| Host | URI | Name | Action | Protected | Version(s) | Scope(s) |
+----------------+----------------+------+---------+-----------+------------+----------+
| api.kayice.com | GET|HEAD users | | Closure | No | v1 | |
+----------------+----------------+------+---------+-----------+------------+----------+
然后我php artisan serve
转到localhost:8000/user
它只是向我显示此抱歉,找不到您要查找的页面.
可能会因此错过任何事情吗?
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?
已编辑
我已经在app.php中添加了提供程序,我认为在供应商发布后,api工作正常,然后一切都应该工作.还是laravel 5.2问题?
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?
我现在想出什么问题了,我没有在api.php中添加前缀.因此,它没有给我带来价值.
已编辑
但是它仍然不支持,很可能系统仍然不能很好地支持
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