Respect/Rest

Allow Router as Target

m42e opened this issue · 2 comments

m42e commented

This is a feature I really miss in Respect/Rest is, to allow subrouters.

Eg. define sub routers:

$blog = new Router;
$blog->get('/', function() {
    return 'This is my Blog';
});

$site = new Router;
$site->get('/', function() {
    return 'This is the main site';
});
$site->get('/contact', function() {
    return 'Contact';
});

And then have a master:

$r3 = new Router;
$r3->get('/blog', $blog);
$r3->get('/site', $site);

If you like the Idea, I may also offer an implementation, but this takes a week or two.

So that /site/contact will result in Contact and /blog will result in This is my Blog

Seconded, this would be extremely useful.

it would be awesome