3
Checking the logs on the server found the following error:
Slim Application Error:
Type: FastRoute\BadRouteException
Message: Static route "/client/schedules" is shadowed by previously defined variable route "/client/([^/]+)" for method "GET"
and even though you’ve researched it really hasn’t become clear what can cause this kind of exception.
Route organisation, if relevant:
#Client routes
$app->get('/client[/{id}]', function(Request $request, Response $response, $args){});
$app->post('/client', function(Request $request, Response $response, $args){});
$app->delete('/client', function(Request $request, Response $response, $args){});
#Credit routes
$app->post('/credits/buy', function(Request $request, Response $response, $args){});
#deliveryman routes
$app->post('/deliveryman', function(Request $request, Response $response, $args){});
#Moip routes
$app->get('/teste', function (Request $request, Response $response, $args){});
#Plan routes
$app->get('/plans', function(Request $request, Response $response, $args){});
$app->post('/plans', function(Request $request, Response $response, $args){});
$app->post('/plans/sign', function(Request $request, Response $response, $args){});
#Responses routes
$app->get('/error', function(Request $request, Response $response, $args){});
#Schedule routes
$app->get('/schedule', function (Request $request, Response $response, $args ){});
$app->post('/schedule/deny/{id}', function(Request $request, Response $response, $args){});
$app->post('/schedule/cancel/{id}', function(Request $request,Response $response, $args){ });
$app->post('/schedule/accept/{id}', function(Request $request,Response $response, $args){});
$app->post('/schedule/accept', function(Request $request,Response $response, $args){});
//client
$app->post('/schedule', function (Request $request, Response $response, $args ){});
#Users routes
$app->get('/login/{type}', function (\Slim\Http\Request $request, \Slim\Http\Response $response, $args) {});
$app->get('/logout', function (\Slim\Http\Request $request, \Slim\Http\Response $response, $args) {});
You’re accessing a route
/client/schedules
statically, while there is already a dynamic route definition for/client[/{id}]
.– Marcelo de Andrade
apparently it had a duplicate route, but it was worth =D
– wagnermps
If my comment helped you answer, I’ll come up with an answer. If not, leave your answer as to how you solved the problem, it may help others in the future.
– Marcelo de Andrade
Yes I’m sorry, I had completely forgotten about the post, because well the solution was the following there was a static get route running after the dynamic route. This way we only needed to reorder, adding the static route before the dynamic route.
– wagnermps