Getting Method not allowed Message While Using Post Method in Routes

Hello Guys,

It is the first time I am using PHP Slim Framework. I am having a trouble with the framework. The problem of mine is the following.

$app->post('/address/{id}/{name}', function ($request, $response, $args) {
echo $args['id'];
echo $args['name'];
$response->isPost();
});

While accessing the page. public/address/123/muhsin - I am ggeting the error
Method not allowed

$app->post only accepts POST methods.
Read more about routes here:
https://www.slimframework.com/docs/objects/router.html

2 Likes