<?php
require_once '../../database/config.php';

$slug = $_GET['slug'] ?? 'test';

$stmt = $db->prepare("SELECT * FROM products WHERE slug = ?");
$stmt->execute([$slug]);
$product = $stmt->fetch(PDO::FETCH_ASSOC);

header('Content-Type: application/json');
echo json_encode($product);
?>
