Lee*_*Lee 2 laravel dingo-api lumen
重新安装Lumen 5.2和新安装的Dingo 1.0.*@dev
我已经安装了bootstrap / app.php中提供的服务
还设置.env文件,例如
API_VERSION=v1
API_PREFIX=api
API_SUBTYPE=app
API_DEBUG=true
Run Code Online (Sandbox Code Playgroud)
在Http / routes.php中,我添加了一个测试路由,例如
$api = app('Dingo\Api\Routing\Router');
$api->version('v1', ['namespace' => 'App\Http\Controllers\V1'], function ($api) {
$api->get('example', 'ExampleController@test');
});
Run Code Online (Sandbox Code Playgroud)
如果我尝试,此路由将无法正常运行并在命令行中 php artisan api:routes
我得到错误
[Symfony\Component\Console\Exception\CommandNotFoundException]
Command "api:routes" is not defined.
Did you mean this?
api:docs
Run Code Online (Sandbox Code Playgroud)
我错过了什么吗?还可以使用HTTP Basic吗?
小智 5
在Dingo文档->创建API端点部分中,您可以找到以下句子:
“如果您使用Laravel 5.1,则可以使用Artisan查看已注册的路线。
$ php artisan api:routes
Run Code Online (Sandbox Code Playgroud)
”
如果你还跑
$ php artisan list
Run Code Online (Sandbox Code Playgroud)
仅api:docs可用-缺少api:routes。
这意味着该命令在流明中不起作用。