Better solution for groups without a prefix

This commit is contained in:
William 2023-03-21 21:55:36 +01:00
parent 74bd080709
commit 8cf26b4d0d
2 changed files with 2 additions and 2 deletions

View File

@ -73,7 +73,7 @@ abstract class Route
);
}
static function group(string $prefix = '', ?callable $callback = null)
static function group(string $prefix, callable $callback)
{
if (!str_starts_with(
$_SERVER['REQUEST_URI'],

View File

@ -51,7 +51,7 @@ App::group('/test', function() {
fn() => print('Testing 123'));
// you may also define a group without a prefix
App::group(callback: function() {
App::group('', function() {
App::get('/test',
fn() => print('Testing 456'));
});