Unable to send numbers using res.send() using express with node

According to Express res.send([body]) docs:

The body parameter can be a Buffer object, a String, an object, or an Array

You can’t send a number by itself.

Try either converting the number to a string

res.send(''+result.rows[0].doc.imdb.rating);

or send it as an object value

res.send({ result: result.rows[0].doc.imdb.rating});

Leave a Comment