Thursday 28 September 2017

Not including res.send(200)

I've been thaught that you need to have res.send(200) if a call is succesfull in your API method, or else any client will receive a timeout exception.But some of my api methods do not include res.send(200), and it works fine(I didn't get a timeout exception). Eg:router.post("/insertTestData", function(req, res){ console.log("Hello"); let sql = `INSERT INTO airbnb.testing(name) VALUES(?)`; let values = [req.body.name]; app.con.query(sql, values, function (err, result) { console.log(result); }); });

Submitted September 29, 2017 at 01:48AM by badboyzpwns

No comments:

Post a Comment