Routing weirdness


#1

Hi,

I’m having some weird issues with slim routing. I have this 3 simple routes.

$app->get('/', function (Request $request, Response $response, array $args) {
   die('root');
});

$app->get('/foo', function (Request $request, Response $response, array $args) {
    die('foo');
});

$app->get('/{name}', function (Request $request, Response $response, array $args) {
    var_dump($args);die;
});

If I point may browser to http://localhost:8001 I get root
If I point may browser to http://localhost:8001/foo I get root
If I point may browser to http://localhost:8001/bar I get root

When I hit http://localhost:8001/foo I should be getting foo
and when I hit http://localhost:8001/bar I should be getting the args dump

Is my assumption correct or I’m seeing this incorrectly?


#2

That looks fine at first glance. Which web server are you using and how are you routing requests to the front controller?


#3

I created tree repos to demonstrate the problem:



The readme explains the issues


#4

I added the versions with only base slim… because slim was updated recently. and i wanted to make sure it was not an bug on the new version.

im just running php internal server from local


#5

again… I’m might be doing something extremely stupid. but i don’t see what

the problem Im getting is with the skeleton version… is not routing properly


#6

$ php -S localhost:8003 -t public public/index.php


#7

thanks, I knew that was not me and was an issue with paranormal activity :blush: