Code RoomRelayed ID queries wrong row
HardPrep Room Coding #1750

Relayed ID queries wrong row

Code reviewCode quality & reviewSenior–Staff~30 min

Review this Node.js code that reads a 64-bit ID from a JSON API and echoes it back.

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.

0:00 of about 30 min
Mark a line and say what kind of problem it is.0 findings
1async function relayId(req, res) {
2 const body = await req.json(); // { "id": 9007199254740993, ... }
3 const id = body.id;
4 const row = await db.query('SELECT * FROM events WHERE id = $1', [id]);
5 res.json({ id, found: row.length > 0 });
6}
Which questions mattered is sealed until you submit. Telling you now would just be handing over the edge cases.