Search with rest API

This commit is contained in:
2024-04-03 16:33:02 +02:00
parent c0f053e131
commit 2ebae1bf0e
3 changed files with 37 additions and 14 deletions

View File

@@ -1,6 +1,13 @@
<?php
require_once 'src/router.php';
require_once '../php/constants.php';
require_once '../php/db/dbconnect.php';
require_once '../php/db/Search.php';
ini_set('display_errors', 1);
error_reporting(E_ALL);
$pdo = dbConnect();
$router = new Router();
@@ -8,6 +15,22 @@ $router->GET('/api/requests', ["test"], function($test){
echo json_encode($test);
});
$router->GET('/api/search', ["type"], function($type){
global $pdo;
searchDoctor($pdo, $type);
});
$router->GET('/api/search', ["type", "location"], function($type, $location){
global $pdo;
searchDoctorByLocation($pdo, $location, $type);
});
$router->GET('/api/search', ["location"], function($location){
global $pdo;
searchDoctorByLocation($pdo, $location);
});
$router->POST('/api/requests', ["test"], function($test){
echo json_encode($test);
});