I am working on Node JS and PostgreSQL and I am creating REST web service using this. I have created a post method and calling web service through POSTMAN but unable to get parameter values in my function. Web service inserting null value in my PostgreSQL table. I am using Visual studio 2015 unable to debug code. How can I achieve this ?
queries.js
function addTask(req, res, next) {
debugger;
var task_name = req.body.task_name;
var task_type = req.body.task_type;
db.func('inserttask', [task_name, task_type])
.then(function () {
res.status(200)
.json({
status: 'success',
message: 'Inserted one task'
});
})
.catch(function (err) {
return next(err);
});
}
index.js
router.post('/api/addtask', db.addTask);
via Moin Khan
No comments:
Post a Comment