diff options
| author | yyamashita <yyamashita@mosquit.one> | 2026-05-09 14:36:28 +0900 |
|---|---|---|
| committer | yyamashita <yyamashita@mosquit.one> | 2026-05-09 14:36:28 +0900 |
| commit | 0e12e7238f48ffc2a5d35dae059c2f00c7250f3b (patch) | |
| tree | bafbc876a6d3c0239c58ad888247c9e5a4161628 /app/routes/api-export.tsx | |
| parent | e2f492ccae9afcc98ae7eb76bb94dc973aed60d8 (diff) | |
Add /api/export and /api/import endpoints for DB backup and sync
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'app/routes/api-export.tsx')
| -rw-r--r-- | app/routes/api-export.tsx | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/app/routes/api-export.tsx b/app/routes/api-export.tsx new file mode 100644 index 0000000..17437df --- /dev/null +++ b/app/routes/api-export.tsx @@ -0,0 +1,16 @@ +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; +} |
