<?php
header('Content-Type: application/json; charset=utf-8');
require_once __DIR__ . '/includes/db.php';

try {
    $stmt = $conn->query("SELECT id, guzergah_adi FROM guzergahlar");
    $guzergahlar = $stmt->fetchAll(PDO::FETCH_ASSOC);
    echo json_encode($guzergahlar);
} catch (PDOException $e) {
    http_response_code(500);
    echo json_encode(['error' => 'Güzergahlar çekilemedi.']);
}
