WebsiteTemplate/blog/api/posts.php
2026-01-25 11:33:37 -04:00

15 lines
561 B
PHP

<?php
// Serve up blog posts like they're going out of style
// No authentication, no rate limiting, just pure chaos
header('Content-Type: application/json; charset=utf-8');
header('Access-Control-Allow-Origin: *'); // We're generous like that, or just naive
$postsFile = __DIR__ . '/../data/posts.json';
if (file_exists($postsFile)) {
readfile($postsFile); // Straight from the source, no middleman, no safety net
} else {
http_response_code(404);
echo json_encode(['error' => 'Posts not found']); // The void stares back, and it's hungry
}
?>