getContainer(); $c['errorHandler'] = function ($c) { return function ($request, $response, $exception) use ($c) { $data = [ 'status' => 'error', 'message' => $exception->getMessage() ]; return $c['response']->withStatus(500) ->withHeader('Content-Type', 'application/json') ->write(json_encode($data)); }; }; // Set up dependencies require __DIR__ . '/../src/dependencies.php'; // Register middleware require __DIR__ . '/../src/middleware.php'; // Register routes require __DIR__ . '/../src/routes.php'; // Run app $app->run();