Spaces:
Runtime error
Runtime error
| import { Router } from 'express'; | |
| import type { Request, Response } from 'express'; | |
| import { getUnifiedApiKey, regenerateUnifiedKey } from '../db/index.js'; | |
| export const settingsRouter = Router(); | |
| // Get the unified API key | |
| settingsRouter.get('/api-key', (_req: Request, res: Response) => { | |
| res.json({ apiKey: getUnifiedApiKey() }); | |
| }); | |
| // Regenerate the unified API key | |
| settingsRouter.post('/api-key/regenerate', (_req: Request, res: Response) => { | |
| const newKey = regenerateUnifiedKey(); | |
| res.json({ apiKey: newKey }); | |
| }); | |