diff --git a/Source/API/script/index.php b/Source/API/script/index.php index acb769c..a038c8b 100644 --- a/Source/API/script/index.php +++ b/Source/API/script/index.php @@ -27,16 +27,8 @@ try{ $app->get('/', function (Request $request, Response $response) { $parameters = $request->getQueryParams(); - foreach ($parameters as $key => $value) { - $response->getBody()->write("Key =>".$key.", value =>".$value); - } - return $response; - }); - - - $app->get('/api/{method}', function (Request $request, Response $response, $args) { - $method = $args['method']; - $parameters = $request->getQueryParams(); + $method = $parameters['method']; + $response->getBody()->write($method); $listGateway = array("\\Gateway\\GatewayForm", "\\Gateway\\GatewayKeyword", "\\Gateway\\GatewayQuestion"); foreach ($listGateway as $gateway) // Pour chaque Gateway { @@ -45,8 +37,12 @@ try{ } } $response->getBody()->write("Use the method $method, with the parameters "); + foreach ($parameters as $key => $value) { + $response->getBody()->write("Key =>" . $key . ", value =>" . $value); + } return $response; }); + // Run app $app->run(); }catch (HttpNotFoundException|Exception $e){