diff --git a/CHANGELOG.md b/CHANGELOG.md index c2695e1..d705741 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,9 +1,10 @@ # Changelog -## [1.0.0] - 25/05/2020 +## [1.0.0] - 31/05/2020 ### Recursos adicionados * API * Repositórios DB e FILE * Integração Contínua +* Política de consumo da api diff --git a/README.md b/README.md index 9ea9db8..5c28493 100644 --- a/README.md +++ b/README.md @@ -73,6 +73,18 @@ Veja http://localhost:8080 ## API + +**Importante:** + +Atualmente temos uma api demonstração no seguinte endereço: https://cid10-api.herokuapp.com. +No entanto, a partir de 2021 ela será desativada e funcionará na seguinte url: https://cid.mokasof.org. + +Você só pode fazer 60 requisições por minuto. Com um tempo de retenção de 3 minutos caso exceda o limite. +Se você se sentir mal por isso sinta-se livre para fazer um clone do projeto e executar a api na sua máquina, +basta configurar essa política como falsa no arquivo .env `APP_THROTTLE=false` + +Servidores não dão em árvore e não tente enganar as nossas estatisticas. + ##### CID-10 |Nome|Descrição|Rota|Demo| diff --git a/bootstrap/app.php b/bootstrap/app.php index 5c706bc..d999e56 100644 --- a/bootstrap/app.php +++ b/bootstrap/app.php @@ -38,14 +38,10 @@ | */ -/*register cors policy*/ +$app->register(GrahamCampbell\Throttle\ThrottleServiceProvider::class); $app->register(Fruitcake\Cors\CorsServiceProvider::class); $app->configure('cors'); -$app->middleware([ - \Fruitcake\Cors\HandleCors::class, - \App\Http\Middleware\VisitorAnalyticsMiddleware::class -]); $app->singleton( Illuminate\Contracts\Console\Kernel::class, @@ -101,13 +97,14 @@ | */ -// $app->middleware([ -// App\Http\Middleware\ExampleMiddleware::class -// ]); +$app->middleware([ + \Fruitcake\Cors\HandleCors::class, + \App\Http\Middleware\VisitorAnalyticsMiddleware::class +]); -// $app->routeMiddleware([ -// 'auth' => App\Http\Middleware\Authenticate::class, -// ]); +$app->routeMiddleware([ + 'throttle' => GrahamCampbell\Throttle\Http\Middleware\ThrottleMiddleware::class, +]); /* |-------------------------------------------------------------------------- @@ -137,6 +134,7 @@ $app->router->group([ 'namespace' => 'App\Http\Controllers', + 'middleware' => env('APP_THROTTLE') ? 'throttle:60,3' : null ], function ($router) { require __DIR__.'/../routes/web.php'; require __DIR__.'/../routes/api.php'; diff --git a/composer.json b/composer.json index 670f8fa..f87b0ea 100644 --- a/composer.json +++ b/composer.json @@ -1,5 +1,5 @@ { - "name": "Atiladanvi/cid-api-php", + "name": "atiladanvi/cid-api-php", "description": "Api com todas as doenças catalogadas pela OMS.", "authors": [ { @@ -14,6 +14,7 @@ "php": "^7.2.5", "ext-json": "*", "fruitcake/laravel-cors": "^2.0", + "graham-campbell/throttle": "^8.0", "laravel/lumen-framework": "^7.0" }, "require-dev": { diff --git a/composer.lock b/composer.lock index 8c090f6..b11b33e 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "6410821499b7296448b0126328294b5e", + "content-hash": "17b4c7412a3497865c5804465b5a7966", "packages": [ { "name": "asm89/stack-cors", @@ -439,6 +439,83 @@ ], "time": "2020-05-11T09:29:18+00:00" }, + { + "name": "graham-campbell/throttle", + "version": "v8.0.1", + "source": { + "type": "git", + "url": "https://github.com/GrahamCampbell/Laravel-Throttle.git", + "reference": "63434493cba8fb7a637e318c14593ec57acd22d7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/GrahamCampbell/Laravel-Throttle/zipball/63434493cba8fb7a637e318c14593ec57acd22d7", + "reference": "63434493cba8fb7a637e318c14593ec57acd22d7", + "shasum": "" + }, + "require": { + "illuminate/cache": "^6.0|^7.0", + "illuminate/contracts": "^6.0|^7.0", + "illuminate/http": "^6.0|^7.0", + "illuminate/support": "^6.0|^7.0", + "php": "^7.2.5" + }, + "require-dev": { + "graham-campbell/analyzer": "^3.0", + "graham-campbell/testbench": "^5.4", + "mockery/mockery": "^1.3.1", + "phpunit/phpunit": "^8.5|^9.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "8.0-dev" + }, + "laravel": { + "providers": [ + "GrahamCampbell\\Throttle\\ThrottleServiceProvider" + ] + } + }, + "autoload": { + "psr-4": { + "GrahamCampbell\\Throttle\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Graham Campbell", + "email": "graham@alt-three.com" + } + ], + "description": "Throttle Is A Rate Limiter For Laravel", + "keywords": [ + "Graham Campbell", + "GrahamCampbell", + "Laravel Throttle", + "Laravel-Throttle", + "framework", + "laravel", + "rate limit", + "throttle", + "throttling" + ], + "funding": [ + { + "url": "https://github.com/GrahamCampbell", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/graham-campbell/throttle", + "type": "tidelift" + } + ], + "time": "2020-04-14T13:09:06+00:00" + }, { "name": "illuminate/auth", "version": "v7.13.0",