When I make an ajax request with POST method and the below route:
router.post('/shows', function(req, res){
model.find({}, function(sent, recieved){
res.contentType('json');
res.send({ some: JSON.stringify({response:'json'}) });
});
});
I get error 500,
When I use ajax request with GET method and the below route
router.get('/shows', function(req, res){
model.find({}, function(sent, recieved){
res.contentType('json');
res.send({ some: JSON.stringify({response:'json'}) });
});
});
it works.
I make an ajax request with jQuery:
$.ajax({
type: "POST",
url: "/shows",
dataType:"json"
})
.done(function( done ) {
console.log(done)
});
My console says:
express deprecated res.send(status, body):
Use res.status(status).send(body) instead node_modules/kraken-js/middleware/500.js:27:17
Any ideas why my post route is not returning data properly?