mirror of
https://codeberg.org/vlw/vlw.se.git
synced 2026-04-13 01:39:40 +02:00
feat: add ping public API endpoint
This commit is contained in:
parent
eeaaeeecdd
commit
45efbff5c6
2 changed files with 25 additions and 0 deletions
23
api/ping/GET.php
Normal file
23
api/ping/GET.php
Normal file
|
|
@ -0,0 +1,23 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
use Reflect\{Response, Path};
|
||||||
|
|
||||||
|
use VLW\API\API;
|
||||||
|
|
||||||
|
require_once Path::root("src/API/API.php");
|
||||||
|
|
||||||
|
final class GET_Ping extends API {
|
||||||
|
public function __construct() {
|
||||||
|
parent::__construct();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function main(): Response {
|
||||||
|
return new Response([
|
||||||
|
"ping" => "pong",
|
||||||
|
"GET" => $_GET,
|
||||||
|
"POST" => $_POST,
|
||||||
|
"HEADERS" => getallheaders(),
|
||||||
|
"datetime" => new DateTimeImmutable(),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -10,6 +10,7 @@ SET time_zone = "+00:00";
|
||||||
|
|
||||||
TRUNCATE TABLE `acl`;
|
TRUNCATE TABLE `acl`;
|
||||||
INSERT INTO `acl` (`ref_group`, `ref_endpoint`, `method`) VALUES
|
INSERT INTO `acl` (`ref_group`, `ref_endpoint`, `method`) VALUES
|
||||||
|
(NULL, 'ping', 'GET'),
|
||||||
(NULL, 'coffee', 'GET'),
|
(NULL, 'coffee', 'GET'),
|
||||||
(NULL, 'languages', 'GET'),
|
(NULL, 'languages', 'GET'),
|
||||||
(NULL, 'update', 'GET'),
|
(NULL, 'update', 'GET'),
|
||||||
|
|
@ -19,6 +20,7 @@ INSERT INTO `acl` (`ref_group`, `ref_endpoint`, `method`) VALUES
|
||||||
|
|
||||||
TRUNCATE TABLE `endpoints`;
|
TRUNCATE TABLE `endpoints`;
|
||||||
INSERT INTO `endpoints` (`id`, `active`) VALUES
|
INSERT INTO `endpoints` (`id`, `active`) VALUES
|
||||||
|
('ping', 1),
|
||||||
('coffee', 1),
|
('coffee', 1),
|
||||||
('languages', 1),
|
('languages', 1),
|
||||||
('update', 1),
|
('update', 1),
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue