Add article creation
This commit is contained in:
16
endpoints/newsarticle.php
Normal file
16
endpoints/newsarticle.php
Normal 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"],
|
||||
};
|
||||
}
|
Reference in New Issue
Block a user