Code Room
Code reviewMedium
Question
Review this Node.js function using a node-postgres pool.
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
async function getProfile(pool, userId) { const client = await pool.connect(); const { rows } = await client.query( 'SELECT * FROM profiles WHERE user_id = $1', [userId] ); if (rows.length === 0) { throw new NotFoundError('no profile'); } client.release(); return rows[0];}Run or narrate your approach, then ask the coach.