Gateway exposes internal errors
Review this TypeScript gateway handler that calls an internal payments microservice and relays its result to the public client.
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 25 min
Mark a line and say what kind of problem it is.0 findings
1app.get('/balance', async (req, res) => {
2 const upstream = await fetch(
3 `http://payments-svc/internal/accounts/${req.query.acct}/balance`,
4 );
5 const data = await upstream.json();
6 // mirror the internal service's status + body to the client
7 res.status(upstream.status).json(data);
8});
Which questions mattered is sealed until you submit. Telling you now would just be handing over the edge cases.
Run or narrate your approach, then ask the coach.