From 7167670b929c4f3fec015404893ade05128b1ea4 Mon Sep 17 00:00:00 2001 From: viastolfi Date: Fri, 9 Dec 2022 14:02:19 +0100 Subject: [PATCH] ajout de routes --- Sources/API/api/inscrit/add.php | 3 +++ Sources/API/api/inscrit/read.php | 2 +- Sources/API/{models => gateways}/Inscrit.php | 0 Sources/API/index.php | 6 +++++- 4 files changed, 9 insertions(+), 2 deletions(-) create mode 100644 Sources/API/api/inscrit/add.php rename Sources/API/{models => gateways}/Inscrit.php (100%) diff --git a/Sources/API/api/inscrit/add.php b/Sources/API/api/inscrit/add.php new file mode 100644 index 0000000..b637268 --- /dev/null +++ b/Sources/API/api/inscrit/add.php @@ -0,0 +1,3 @@ + \ No newline at end of file diff --git a/Sources/API/api/inscrit/read.php b/Sources/API/api/inscrit/read.php index b086c1e..936cf78 100644 --- a/Sources/API/api/inscrit/read.php +++ b/Sources/API/api/inscrit/read.php @@ -3,7 +3,7 @@ header('Content-Type: application/json'); include_once (__DIR__.'/../../config/Database.php'); - include_once (__DIR__.'/../../models/Inscrit.php'); + include_once (__DIR__.'/../../gateways/Inscrit.php'); $database = new Database(); $db = $database->connect(); diff --git a/Sources/API/models/Inscrit.php b/Sources/API/gateways/Inscrit.php similarity index 100% rename from Sources/API/models/Inscrit.php rename to Sources/API/gateways/Inscrit.php diff --git a/Sources/API/index.php b/Sources/API/index.php index 72a2e1e..c35daea 100644 --- a/Sources/API/index.php +++ b/Sources/API/index.php @@ -7,7 +7,7 @@ $router->map( 'GET', '/', function(){ echo 'Hello World'; }); -$router->map('GET','/Inscrit', function(){ +$router->map('GET|POST','/Inscrit', function(){ require(__DIR__.'/api/inscrit/read.php'); }); @@ -15,6 +15,10 @@ $router->map('GET','/Inscrit/[*:mail]', function($mail){ require(__DIR__.'/api/inscrit/readFromMail.php'); }); +$router->match('POST|GET','/Inscrit/add', function(){ + require(__DIR__.'/api/Inscrit/add.php'); +}); + $match = $router->match(); if($match!=null) {