var mysql = require('mysql');
var pool = mysql.createPool({
connectionLimit : 10,
host : 'example.org',
user : 'bob',
password : 'secret',
database : 'my_db'
});
module.exports = pool;
const pool = require('./file');
const query = 'SELECT 1 + 1 AS solution';
const result = await pool.query(query);
router.post('/signin', passport.authenticate('signin',
{
successRedirect: '/',
failureRedirect: '/login'
}
));
res.render('signin', {
errorMessage: info.message,
user: req.user
});
if user
button(type="submit") signin
button(type="submit") signup
else
h1 Hello #{user.name}
nodemailer.createTransport('smtps://email:password@smtp.mail.ru');
let order = await Order.findOne({orderId: ctx.params.id}, {createdAt: 1, _id: 0}).toArray();
$.ajax({
url: 'create/zakaz',
type: 'POST',
dataType: 'json',
data: {id: 1, userId:2}, //для примера
success: fucntion(data){
},
error: function(err){
}
});
router.post('/zakaz', function(req,res,next){
console.log(req.body);
});
var User = mongoose.model('Users', UserSchema);
User.register({username:'username', active: false}, 'password', function(err, user) {
if (err) { ... }
var authenticate = User.authenticate();
authenticate('username', 'password', function(err, result) {
if (err) { ... }
});
});