Tuesday 30 May 2017

[Express] Newbie Error - Can't set headers after they are sent

router.get("/places", function(req, res, next){ database.Place.find({ "lng": req.query.lng, "lat": req.query.lat },function(err , places){ res.json({places:places}); }); return next(); }); router.get("/places", function(req, res){ database.Place.find({ "_id": req.query._id, },function(err , places){ res.json({result:places}); }); }); How would I incorporate next() and closing the header (I 've been told to return res.json())

Submitted May 31, 2017 at 03:16AM by badboyzpwns

No comments:

Post a Comment