Add article creation

This commit is contained in:
2024-02-22 10:05:09 +01:00
parent 06feb93095
commit 5be90d8e95
3 changed files with 38 additions and 3 deletions

16
endpoints/newsarticle.php Normal file
View File

@@ -0,0 +1,16 @@
<?php
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"],
};
}