```php
<?php

require_once '../../core/api_bootstrap.php';

$data = Request::get();

try {

Validator::required($data,['slug']);

$db = new Database();
$conn = $db->connect();

$query="

SELECT

b.*,
c.name as category_name

FROM blog_posts b

LEFT JOIN blog_categories c
ON b.category_id = c.id

WHERE b.slug=:slug
AND b.status='published'

LIMIT 1

";

$stmt=$conn->prepare($query);

$stmt->execute([

':slug'=>$data['slug']

]);

$post=$stmt->fetch();

Response::success($post);

}
catch(Exception $e){

Logger::log("system.log",$e->getMessage());

Response::error("Server error",500);

}