Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
.put('/api/articles/:id', jwtAuth, function (req, res, next) {
var modify = req.body;
var nowTime = Date.now();
modify["time.update"] = nowTime;
if (modify.publish) {
modify["time.publish"] = nowTime;
}
if (modify.meta != undefined) {
if (modify.meta.author != undefined) {
modify["meta.author"] = modify.meta.author;
}
if (modify.meta.keyword != undefined) {
modify["meta.keyword"] = modify.meta.keyword;
}
if (modify.meta.description != undefined) {
modify["meta.description"] = modify.meta.description;
}
delete modify.meta;
}
if(modify.category != undefined && modify.category == 0) {
modify.category = undefined;
}
Article.update2(req.params.id, modify, function (err) {
if (err)
return res.status(500).send(err);
res.sendStatus(200);
});
})
.delete('/api/articles/:id', jwtAuth, function (req, res, next) {