Skip to content

Commit 8693e0a

Browse files
committed
support empty routes
1 parent 92d9e88 commit 8693e0a

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/Tqdev/PhpCrudApi/Middleware/Router/SimpleRouter.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,11 @@ public function register(string $method, string $path, array $handler)
7171
$routeNumber = count($this->routeHandlers);
7272
$this->routeHandlers[$routeNumber] = $handler;
7373
if ($this->registration) {
74-
$parts = explode('/', trim($path, '/'));
74+
$path = trim($path, '/');
75+
$parts = array();
76+
if ($path) {
77+
$parts = explode('/', $path);
78+
}
7579
array_unshift($parts, $method);
7680
$this->routes->put($parts, $routeNumber);
7781
}

0 commit comments

Comments
 (0)