feat(infrastructure): Enhance router and API endpoint with proper error handling
This commit is contained in:
@@ -19,11 +19,12 @@ class Router
|
||||
{
|
||||
foreach ($this->routes as $route) {
|
||||
if ($route['method'] === $method && $route['path'] === $uri) {
|
||||
return call_user_func($route['handler']);
|
||||
return \call_user_func($route['handler']);
|
||||
}
|
||||
}
|
||||
|
||||
http_response_code(404);
|
||||
echo "Not Found";
|
||||
header('Content-Type: application/json');
|
||||
echo json_encode(['error' => 'Not Found']);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user