Skip to content

Commit

Permalink
Refactor API throttle protection (Rate Limiting)
Browse files Browse the repository at this point in the history
  • Loading branch information
kkamara committed Mar 24, 2024
1 parent 1f07ba1 commit fe19d55
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion bootstrap/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
->withMiddleware(function (Middleware $middleware) {
$middleware->group('api', [
// \Laravel\Sanctum\Http\Middleware\EnsureFrontendRequestsAreStateful::class,
'throttle:api',
// 'throttle:api',
\Illuminate\Routing\Middleware\SubstituteBindings::class,
]);
})
Expand Down
6 changes: 4 additions & 2 deletions routes/api.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,7 @@
use Illuminate\Support\Facades\Route;
use App\Http\Controllers\ContactController;

Route::post("contact", [ContactController::class, "contact"])
->name("contact");
Route::middleware(['throttle:api'])->group(function () {
Route::post("contact", [ContactController::class, "contact"])
->name("contact");
});

0 comments on commit fe19d55

Please sign in to comment.