module.exports.dataLoad = function(req, res, next){
request('http://fake-url.com/param=param', function (error, response, body) {
if(err){res.json(error);}
else{
res.json(body);
}
}
}
var ctl = require('./ctl.js') //при условии что он в той же папке находится
router.get('/', ctrl.dataLoad);
str.replace(/д.{2,5}й/g, 'дверей')
Popup.prototype.openPopup = function(){
//здесь опишите что должно происходить при вызове...можете сразу reInit запихать..
}
Gallery.prototype.__proto__ = Popup.prototype;
connection.query(sql, values[0], function(err, result) {
console.log('Документ изменен');
});
var values = [
req.body.programmNumber,
req.body.fullName,
req.body.company,
req.body.personnelCategory,
req.body.subdivision,
req.body.position,
req.body.theoreticalTraining,
req.body.practicalTraining,
req.body.internship,
req.body.termOfTraining,
req.body.trainingInTheUTC,
req.body.trainingInTheUnit,
req.body.registrationDateOfTheProgram,
req.body.dateOfDelivery,
req.body.fullNameProgram,
req.body.link,
req.body.status,
req.body.id
]
connection.query(sql, values, function(err, result) {
if(err){console.log(err)}
else{
console.log(result);
}
console.log('Документ изменен');
});
// passport config
var Account = require('./models/account');
passport.use(new LocalStrategy(Account.authenticate()));
passport.serializeUser(Account.serializeUser());
passport.deserializeUser(Account.deserializeUser());
var passport = require('passport')
, LocalStrategy = require('passport-local').Strategy;
passport.use(new LocalStrategy(
function(username, password, done) {
User.findOne({ username: username }, function (err, user) {
if (err) { return done(err); }
if (!user) {
return done(null, false, { message: 'Incorrect username.' });
}
if (!user.validPassword(password)) {
return done(null, false, { message: 'Incorrect password.' });
}
return done(null, user);
});
}
));
app.post('/login', passport.authenticate('local', { successRedirect: '/',
failureRedirect: '/login' }));
docs.forEach( function (x) {
x.sub = [];
db.get().collection('tasks').find({"parent_id": x._id.toString()}).sort({order: 1}).toArray(function(err, data){
x.sub.push(data);
});
});
Например по кнопке сохранить один ajax сохраняет изображение другой текстовые данные в бд.