fix: remove /api prefix from fireApiRoutes()
Some checks failed
CI / PHP 8.3 (push) Has been cancelled
CI / PHP 8.4 (push) Has been cancelled

API routes are domain-scoped (api.lthn.ai, mcp.lthn.ai), not
path-embedded. The /api prefix forced workarounds for Website
modules that need stateless routes without path nesting.

No other frontage (web, admin, client, mcp) enforced a path prefix —
api was the odd one out.

Co-Authored-By: Virgil <virgil@lethean.io>
This commit is contained in:
Snider 2026-03-04 12:39:44 +00:00
parent f2c0c5f225
commit c953ec7aac

View file

@ -76,7 +76,7 @@ use Livewire\Livewire;
* ├─── Front/Api/Boot ──────────────────────────────────────────────────
* └── LifecycleEventProvider::fireApiRoutes()
* Fires: ApiRoutesRegistering
* Processes: routes ('api' middleware, '/api' prefix)
* Processes: routes ('api' middleware)
*
* ├─── Front/Client/Boot ───────────────────────────────────────────────
* └── LifecycleEventProvider::fireClientRoutes()
@ -385,9 +385,10 @@ class LifecycleEventProvider extends ServiceProvider
*
* Called by Front/Api/Boot when REST API routes are being set up.
*
* Routes registered through this event are automatically:
* - Wrapped with the 'api' middleware group
* - Prefixed with '/api'
* Routes registered through this event are automatically wrapped
* with the 'api' middleware group (stateless, no CSRF).
* No prefix is applied API routes live on domain-scoped subdomains
* (e.g., api.lthn.ai/v1/brain/recall).
*/
public static function fireApiRoutes(): void
{
@ -396,7 +397,7 @@ class LifecycleEventProvider extends ServiceProvider
// Process route requests with api middleware
foreach ($event->routeRequests() as $callback) {
Route::middleware('api')->prefix('api')->group($callback);
Route::middleware('api')->group($callback);
}
}