This repository has been archived on 2026-01-31. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
blue-ocean/app/api/backup/route.ts
2025-01-25 20:39:55 +01:00

16 lines
488 B
TypeScript

import { redis } from '@utils/redis';
import { NextResponse } from 'next/server';
import crypto from 'crypto';
export async function POST(req: Request) {
try {
const { state } = await req.json();
const key = crypto.randomBytes(8).toString('hex');
await redis.set(key, JSON.stringify(state));
return NextResponse.json({ success: true, key });
} catch (error) {
console.error(error);
return NextResponse.json({ error: 'Backup failed' }, { status: 500 });
}
}