import { exportDb } from "~/lib/db.server";

export function loader() {
  const data = exportDb();
  const date = new Date().toISOString().slice(0, 10);
  return new Response(JSON.stringify(data, null, 2), {
    headers: {
      "Content-Type": "application/json",
      "Content-Disposition": `attachment; filename="whois-export-${date}.json"`,
    },
  });
}

export default function () {
  return null;
}
