- Create Newsletter Page: MailingList (without the class style, using Gulp tasks)#94

This commit is contained in:
Paolo Arena
2019-11-21 00:18:40 +01:00
parent 20a3120054
commit f7fa0c4909
54 changed files with 675 additions and 51 deletions

View File

@@ -0,0 +1,26 @@
const express = require('express');
const router = express.Router();
const mongoose = require('mongoose');
const cfgserver = mongoose.model('cfgserver');
const tools = require('../tools/general');
var { authenticate } = require('../middleware/authenticate');
router.post('/updateval', authenticate, (req, res) => {
console.log('/updateval', req.body.pairval);
pair = req.body.pairval;
cfgserver.findOneAndUpdate({chiave: pair.chiave, userID: pair.userId}, { $set: pair }, { new: false }).then((item) => {
// cfgserver.find({ chiave: pair.chiave }, (err, item) => {
res.status(200).send();
}).catch(err => {
console.log('ERR:', err);
res.status(400).send();
})
});
module.exports = router;