withRouting( api: __DIR__.'/../routes/api.php', commands: __DIR__.'/../routes/console.php', health: '/up', apiPrefix: 'api/v1', ) ->withMiddleware(function (Middleware $middleware): void { // API uses token-based auth, no CSRF needed }) ->withExceptions(function (Exceptions $exceptions): void { // Return JSON for all API exceptions $exceptions->render(function (NotFoundHttpException $e, Request $request) { if ($request->is('api/*')) { return response()->json([ 'success' => false, 'message' => 'Resource not found', ], 404); } }); })->create();