Adds `VerifyApiKey` middleware protecting all API routes with `X-Api-Key` header validation. Wraps `/api/stations`, `/api/stats/searches`, and `/api/prediction` in throttled middleware group (60 req/min). Updates StationSearchTest to use `RefreshDatabase`, adds `meta` assertion checks, and validates `fuel_type` in HTTP request assertions. Removes auth routes from API docs and replaces with API key authentication instructions. Adds `api_secret_key` config option.
14 lines
528 B
PHP
14 lines
528 B
PHP
<?php
|
|
|
|
use App\Http\Controllers\Api\PredictionController;
|
|
use App\Http\Controllers\Api\StationController;
|
|
use App\Http\Controllers\Api\StatsController;
|
|
use App\Http\Middleware\VerifyApiKey;
|
|
use Illuminate\Support\Facades\Route;
|
|
|
|
Route::middleware(['throttle:60,1', VerifyApiKey::class])->group(function (): void {
|
|
Route::get('/stations', [StationController::class, 'index']);
|
|
Route::get('/stats/searches', [StatsController::class, 'searches']);
|
|
Route::get('/prediction', [PredictionController::class, 'index']);
|
|
});
|