Code Room
Code reviewMediumcr-g360
Subject Input validationLevel Mid–Senior~20 minCommon in Algorithms & data structures interviewsIndustries Software development, Technology

Question

Review this TypeScript endpoint that resolves a list of product ids to full records.

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.

Talk through your review
Code to reviewtypescript
app.post('/products/resolve', async (req, res) => {  const ids: string[] = req.body.ids;  const products = await Promise.all(    ids.map((id) => db.products.findById(id)),  );  res.json({ products });});
Run or narrate your approach, then ask the coach.