import { getDb } from "../db.js";

export async function GET() {
  const db = getDb();

  const rows = db
    .prepare("SELECT DISTINCT city FROM ranges ORDER BY city")
    .all();

  const cities = rows.map((row) => row.city);

  return new Response(JSON.stringify(cities), {
    headers: { "Content-Type": "application/json; charset=utf-8" },
  });
}
