As the title said, adding middlewares with $app->addRoute($method, $path, $handler, ['middleware'=>[...]]) not gonna work because the script that add the middleware overwritten.
Please inspect this line
public function addRoute($httpMethod, string $route, $handler, array $options = [])
{
// ...
return $router->addRoute($httpMethod, $route, $handler, $options = []);
}
It should return $router->addRoute($httpMethod, $route, $handler, $options);.
As the title said, adding middlewares with
$app->addRoute($method, $path, $handler, ['middleware'=>[...]])not gonna work because the script that add the middleware overwritten.Please inspect this line
It should
return $router->addRoute($httpMethod, $route, $handler, $options);.