rotas nomeadas corrigidas

This commit is contained in:
Reginaldo
2023-06-14 11:29:53 -03:00
parent 00d21cc8c5
commit 38cbb4dc8c
10 changed files with 64 additions and 20 deletions

View File

@@ -12,8 +12,7 @@ function load(string $controller, string $action){
if(!method_exists($controllerInstance,$action)){
throw new Exception("O método {$action} não existe");
}
$controllerInstance->$action();
$controllerInstance->$action((object)$_REQUEST);
}catch(Exception $e){
echo $e->getMessage();
}
@@ -21,10 +20,16 @@ function load(string $controller, string $action){
$router= [
"GET"=>[
"/projeto/api_educa/"=> fn()=> load("HomeController","index"),
"/projeto/api_educa/login" => fn()=> load("LoginController","index")
"/"=> fn()=> load("HomeController","index"),
"/login" => fn()=> load("LoginController","index")
],
"POST"=>[
"/projeto/api_educa/login" => fn()=> load("LoginController","store")
"/login" => fn()=> load("LoginController","store")
]
];
//rodar local host
//php -S localhost:8000
//depois chamar localhost:8000
//http://localhost:8000/login?NO_USERNAME=AMENEZES