2 Commits

Author SHA1 Message Date
KS Jannette
56d0c21b79 clean 2026-02-13 13:45:00 -05:00
S Jannette
37e81e773e Merge pull request #9 from kjannette/refactor4
more
2026-02-13 13:42:52 -05:00
2 changed files with 4 additions and 4 deletions

View File

@@ -3,7 +3,7 @@ import { readFile } from 'fs/promises';
import { clusterNotes } from '../services/clustering.service.js'; import { clusterNotes } from '../services/clustering.service.js';
const router = Router(); const router = Router();
const DATA_PATH = '../data/notes.json' const DATA_PATH = '../data/notes.json';
const loadNotes = async () => { const loadNotes = async () => {
const raw = await readFile(DATA_PATH, 'utf-8'); const raw = await readFile(DATA_PATH, 'utf-8');
@@ -15,7 +15,7 @@ router.get('/', async (req, res) => {
const notes = await loadNotes(); const notes = await loadNotes();
res.json(notes); res.json(notes);
} catch (err) { } catch (err) {
console.error(`Error loading notes: ${err}`) console.error(`Error loading notes: ${err}`);
res.status(500).json({ error: 'Failed to load notes' }); res.status(500).json({ error: 'Failed to load notes' });
} }
}); });
@@ -26,7 +26,7 @@ router.post('/cluster', async (req, res) => {
const clusters = await clusterNotes(notes); const clusters = await clusterNotes(notes);
res.json(clusters); res.json(clusters);
} catch (err) { } catch (err) {
console.error(`Clustering failed: ${err}` ) console.error(`Clustering failed: ${err}`);
res.status(500).json({ error: `Clustering failed: ${err}` }); res.status(500).json({ error: `Clustering failed: ${err}` });
} }
}); });