FastFoodCoding

Login


Connect with one of the following accounts





Login

Please wait while we redirect...

Views: 232 Ask New Question


Getting following error while returning a number

express deprecated res.send(status): Use res.sendStatus(status) instead routes/foo.js:10:9
RangeError [ERR_HTTP_INVALID_STATUS_CODE]: Invalid status code: 3
    at ServerResponse.writeHead (_http_server.js:208:11)
    at ServerResponse._implicitHeader (_http_server.js:199:8)
    at ServerResponse.end (_http_outgoing.js:715:10)
    at ServerResponse.send (/Users/foo/bar/node_modules/express/lib/response.js:221:10)
    at router.get.wrap (/Users/foo/bar/routes/foo.js:10:9)
    at process._tickCallback (internal/process/next_tick.js:68:7)
On By


1 Answer


You can't send numbers using res.send in express, try converting it into a String.

let result = 3;
res.send(result + '');

On By


Answer This Question


Top Tutorials

Top Questions

Top Articles

Top Blogs

Top News