stylehub/endpoints/newsarticle.php

17 lines
414 B
PHP
Raw Normal View History

2024-02-22 10:05:09 +01:00
<?php
2024-04-27 11:48:58 +02:00
declare(strict_types=1);
2024-02-22 10:05:09 +01:00
require_once "lib/newsarticle.php";
function endpoint($endpoint_data): array
{
return match ($endpoint_data["action"]) {
"getNewsArticles" => getNewsArticles(),
"addNewsArticle" => addNewsArticle(
$endpoint_data["title"],
$endpoint_data["body"]
),
default => ["Status" => "Fail", "message" => "Invalid action"],
};
}