-
Notifications
You must be signed in to change notification settings - Fork 17
Routes cannot be both GET and POST #34
Comments
I had this issue as well. I just worked around it by branching in the controller actions. Not awesome, but workable for now.
|
Yeah I ended up doing the same unfortunately. Was hoping this was
|
Hey guys, sorry for such a late response. The reason your routing config isn't working is you have duplicate keys in the config array I removed the middleware and reformatted a little to illustrate:
So you're trying to set the The correct syntax for defining a route with multiple method types is something like this:
|
uhm... the "without" middlewear part isn't working correctly... I get an ugly |
@cs-koneko Can you post the configuration you're using? |
$app = new \SlimController\Slim([
'debug' => true,
'controller.class_prefix' => '\\project\\controllers',
'controller.method_suffix' => 'Action',
'view' => new \Slim\Views\Twig(),
'templates.path' => '../app/views/'
]);
$app->addRoutes(['/' => [
'get' => ['xyzController:index'],
'post' => ['xyzController:create']
]]);
$app->run(); it looked like something like this back then ... only if i put the controller string inside a array I get the message (only the string or inside a array with the closure will work without the Undefined offset notice... |
You cannot have a route that is GET and POST, it will default to the later unlike typical Slim which will support either of a type:
The text was updated successfully, but these errors were encountered: