Thursday, 21 May 2020

What's wrong with this code? It keeps returning {}

app.get('/ping', (req, res) => { result = {}; [{name: 'redis', client: redisClient}, {name: 'postgres', client: pgClient}].forEach(client => client.connect((err, client, release) => { if (err) { result['postgres'] = false; } else { result['postgres'] = true } }) ); res.send(result); })

Submitted May 21, 2020 at 08:01PM by jasonscript

No comments:

Post a Comment