odan / slim4-tutorial

Slim 4 Tutorial - Source Code
98 stars 25 forks source link

group route slim framework4 not working in production #58

Closed islahudin closed 1 year ago

islahudin commented 1 year ago

I'm having trouble. when i create group in routing. The route cannot be accessed by Not Found when I run it in production mode without http://localhost:8080

here is my code

return function (App $app) { $app->get('/', \App\Action\HomeAction::class);

$app->group("/v1", function ($app) {
    $app->get('/bill', \App\Action\HomeAction::class);
});

};

when I access using http://localhost:8080/v1/bill it runs smoothly.

but when I access using (production mode) http://localhost/slim4/v1/bill page Not Found.

Can you help me?

odan commented 1 year ago

When you run your Slim application within a sub-directory of the webservers doucment-root, you need to set the Slim basePath.

You may try these steps to make it work: https://github.com/selective-php/basepath#installation