27 lines
610 B
PHP
27 lines
610 B
PHP
|
<?php
|
||
|
|
||
|
include './http.php';
|
||
|
include_once "./health.php";
|
||
|
|
||
|
function route($path,$handler,$filter=null) { _route($path,$handler,$filter); }
|
||
|
function get($path,$handler) { _methodfn("get")($path,$handler); }
|
||
|
function post($path,$handler) { _methodfn("post")($path,$handler); }
|
||
|
|
||
|
get("^\/health$", function(){
|
||
|
$db = new HealthDB();
|
||
|
printf("%s\n","ok");
|
||
|
});
|
||
|
|
||
|
route("/", function() {
|
||
|
http_response_code(404);
|
||
|
// print_r(msg()->headers);
|
||
|
printf("path: %s\nmethod: %s\nuser-agent: %s\n",
|
||
|
msg()->getUri()->getPath(),
|
||
|
msg()->getMethod(),
|
||
|
msg()->getHeaderLine("user-agent"),
|
||
|
);
|
||
|
});
|
||
|
|
||
|
dispatch();
|
||
|
?>
|