From 352920f5e135b5f57869016c5f0228b8f9be7fa8 Mon Sep 17 00:00:00 2001 From: viastolfi Date: Fri, 25 Nov 2022 11:37:47 +0100 Subject: [PATCH] premier test de route --- Sources/API/config/Config.php | 2 +- Sources/API/{controler => controller}/.gitkeep | 0 Sources/API/controller/Controller.php | 10 ++++++++++ Sources/API/index.php | 12 ++++++++++-- 4 files changed, 21 insertions(+), 3 deletions(-) rename Sources/API/{controler => controller}/.gitkeep (100%) create mode 100644 Sources/API/controller/Controller.php diff --git a/Sources/API/config/Config.php b/Sources/API/config/Config.php index ea5064a..44f585a 100644 --- a/Sources/API/config/Config.php +++ b/Sources/API/config/Config.php @@ -2,7 +2,7 @@ //prefixe $rep=__DIR__.'/../'; -$dsn='mysql:host=10.9.0.67;dbname='.getenv("MARIADB_DATABASE"); +$dsn='mysql:host=10.9.0.65;dbname='.getenv("MARIADB_DATABASE"); $dbname=getenv("MARIADB_DATABASE"); $usr=getenv("MARIADB_USER"); $mdp=getenv("MARIADB_PASSWORD"); diff --git a/Sources/API/controler/.gitkeep b/Sources/API/controller/.gitkeep similarity index 100% rename from Sources/API/controler/.gitkeep rename to Sources/API/controller/.gitkeep diff --git a/Sources/API/controller/Controller.php b/Sources/API/controller/Controller.php new file mode 100644 index 0000000..58a4494 --- /dev/null +++ b/Sources/API/controller/Controller.php @@ -0,0 +1,10 @@ + \ No newline at end of file diff --git a/Sources/API/index.php b/Sources/API/index.php index f663296..dbdd788 100644 --- a/Sources/API/index.php +++ b/Sources/API/index.php @@ -5,6 +5,14 @@ require_once(__DIR__.'/config/Config.php'); require_once(__DIR__.'/config/Autoload.php'); Autoload::charger(); -// loading a controler -$cont = new FrontControler(); +$router = new AltoRouter(); +$router->map('GET|POST',"/","test"); + +$match=$router->match(); + +if(!$match){echo "404"; die;} + +if($match){ + $cont = new Controller(); +} ?> \ No newline at end of file