Code Room
Code reviewHard
Question
Review this Node.js Express handler.
What a strong answer looks like
Separate real bugs from style. Rank issues by severity, point at the root cause rather than the symptom, and suggest a concrete fix — specific and kind.
Learn the concepts
const fs = require('fs'); app.get('/report/:id', (req, res) => { const meta = JSON.parse(fs.readFileSync(`/data/${req.params.id}.json`)); const template = fs.readFileSync('/templates/report.html', 'utf8'); const rows = db.querySync('SELECT * FROM metrics WHERE report = ?', [req.params.id]); const html = render(template, meta, rows); res.send(html);});Run or narrate your approach, then ask the coach.