dnsservice/ansible/assets/api/index.php

27 lines
610 B
PHP
Raw Normal View History

2024-08-05 20:04:05 +00:00
<?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();
?>