是不是 lumen 配合 dingo API 是比较好的 API 解决方案
1个回答
展开全部
打开 config/app.php
接着在 providers 配置里面 加上 Dingo\Api\Provider\LaravelServiceProvider::class
如下:
'providers' => [
Dingo\Api\Provider\LaravelServiceProvider::class
]
写入 config/api.php
php artisan vendor:publish --provider="Dingo\Api\Provider\LaravelServiceProvider"
这是后就在 config文件夹下 多出了 一个 api.php 文件
配置 .env 文件
在.env 文件夹下 增加如下
API_PREFIX=api
API_CONDITIONAL_REQUEST=false
API_STRICT=false
API_DEFAULT_FORMAT=json
到此 后面就不知道该怎么做了
下面是 文档,不理解是什么意思了
全选复制放进笔记Authentication Providers
By default only basic authentication is enabled. Authentication is covered in more detail in a later chapter.
You must configure this in a published configuration file or in your bootstrap file.
$app['Dingo\Api\Auth\Auth']->extend('oauth', function ($app) {
return new Dingo\Api\Auth\Provider\JWT($app['Tymon\JWTAuth\JWTAuth']);
});
Throttling / Rate Limiting
By default rate limiting is disabled. You can register your custom throttles with the rate limiter or use the existing authenticated and unauthenticated throttles.
You must configure this in a published configuration file or in your bootstrap file.
$app['Dingo\Api\Http\RateLimit\Handler']->extend(function ($app) {
return new Dingo\Api\Http\RateLimit\Throttle\Authenticated;
});
接着在 providers 配置里面 加上 Dingo\Api\Provider\LaravelServiceProvider::class
如下:
'providers' => [
Dingo\Api\Provider\LaravelServiceProvider::class
]
写入 config/api.php
php artisan vendor:publish --provider="Dingo\Api\Provider\LaravelServiceProvider"
这是后就在 config文件夹下 多出了 一个 api.php 文件
配置 .env 文件
在.env 文件夹下 增加如下
API_PREFIX=api
API_CONDITIONAL_REQUEST=false
API_STRICT=false
API_DEFAULT_FORMAT=json
到此 后面就不知道该怎么做了
下面是 文档,不理解是什么意思了
全选复制放进笔记Authentication Providers
By default only basic authentication is enabled. Authentication is covered in more detail in a later chapter.
You must configure this in a published configuration file or in your bootstrap file.
$app['Dingo\Api\Auth\Auth']->extend('oauth', function ($app) {
return new Dingo\Api\Auth\Provider\JWT($app['Tymon\JWTAuth\JWTAuth']);
});
Throttling / Rate Limiting
By default rate limiting is disabled. You can register your custom throttles with the rate limiter or use the existing authenticated and unauthenticated throttles.
You must configure this in a published configuration file or in your bootstrap file.
$app['Dingo\Api\Http\RateLimit\Handler']->extend(function ($app) {
return new Dingo\Api\Http\RateLimit\Throttle\Authenticated;
});
上海华然企业咨询
2024-10-21 广告
2024-10-21 广告
上海华然企业咨询有限公司专注于AI与数据合规咨询服务。我们的核心团队来自头部互联网企业、红圈律所和专业安全服务机构。凭借深刻的AI产品理解、上百个AI产品的合规咨询和算法备案经验,为客户提供专业的算法备案、AI安全评估、数据出境等合规服务,...
点击进入详情页
本回答由上海华然企业咨询提供
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询