<?php

header("Access-Control-Allow-Origin: *");
header("Content-Type: application/json");

require_once "config/database.php";

$result = $conn->query("SELECT * FROM users");

$data = [];

while ($row = $result->fetch_assoc()) {
    $data[] = $row;
}

echo json_encode([
    "success" => true,
    "data" => $data
]);

$conn->close();