@accounter/scraper-app
Version:
Scraper app with Fastify server and React UI
12 lines (10 loc) • 462 B
text/typescript
import type { FastifyInstance } from 'fastify';
import { readHistory } from './history.js';
import { getVault, isLocked } from './vault-store.js';
export async function registerHistoryRoutes(app: FastifyInstance): Promise<void> {
app.get('/api/history', async (_req, reply) => {
if (isLocked()) return reply.status(401).send({ error: 'vault-locked' });
const { historyFilePath } = getVault().settings;
return readHistory(historyFilePath);
});
}