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");const dns = require("dns"); app.get("/report", (req, res) => { const cfg = JSON.parse(fs.readFileSync("./report.json", "utf8")); const addr = dns.lookupSync ? dns.lookupSync(cfg.host) : require("dns").lookup; const data = fs.readFileSync(cfg.path, "utf8"); res.send(render(cfg, data));});Run or narrate your approach, then ask the coach.