本文整理汇总了TypeScript中Sequelize.authenticate函数的典型用法代码示例。如果您正苦于以下问题:TypeScript authenticate函数的具体用法?TypeScript authenticate怎么用?TypeScript authenticate使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了authenticate函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: function
this.app.listen(3000, function(){
console.log("Demo Express server listening on port %d in %s mode", 3000);
var config = require('../../config/'+ process.env.NODE_ENV+'.json');
var seq=new Sequelize(config.db, config.username, config.password,config.options);
var compteService:CompteService = new CompteService(seq);
var initCompte=new Compte();
initCompte.numero="numero de compte";
initCompte.pointable=true;
initCompte.lettrable=true;
var onCompteGet=function (newCompte:Compte) {
console.log("compte getted ", newCompte.numero);
};
var onCompteCreated=function (newCompte:Compte) {
console.log("compte created", newCompte.numero);
compteService.getCompteByNumero(newCompte.numero).then(onCompteGet)
};
var onTableCreated = function () {
compteService.addCompte(initCompte).then(onCompteCreated,onFail);
};
var onConnexion = function () {
console.log("connection ok");
compteService.build().then(onTableCreated,onFail);
};
var onFail = function () {
console.log("connection ko");
};
seq.authenticate().then(onConnexion,onFail);
});
示例2: setTimeout
const connectWithRetry = () => {
return sequelize.authenticate()
.then(() => {
logger.info('Connection has been established successfully.');
})
.catch((err) => {
logger.info('Failed to connect to database on startup - retrying in 5 sec', (err));
setTimeout(connectWithRetry, 5000);
});
};
示例3: continueAfterAuthentication
type: Sequelize.INTEGER,
primaryKey: true,
autoIncrement: true
},
userId: {
type: Sequelize.INTEGER,
references: User,
referencesKey: "userId"
},
taskName: Sequelize.STRING
},
{
timestamps: false
});
sequelize
.authenticate()
.complete(function(err)
{
if (err)
{
console.log("Error authenticating with database: " + err);
}
else
{
console.log("Connection established.");
continueAfterAuthentication();
}
});
function continueAfterAuthentication()
{
示例4: Compte
var initCompte=new Compte();
initCompte.numero="numero de compte";
initCompte.pointable=true;
initCompte.lettrable=true;
var onCompteGet=function (newCompte:Compte) {
console.log("compte getted ", newCompte.numero);
};
var onCompteCreated=function (newCompte:Compte) {
console.log("compte created", newCompte.numero);
compteService.getCompteByNumero(newCompte.numero).then(onCompteGet)
};
var onTableCreated = function () {
compteService.addCompte(initCompte).then(onCompteCreated,onFail);
};
var onConnexion = function () {
console.log("connection ok");
compteService.build().then(onTableCreated,onFail);
};
var onFail = function () {
console.log("connection ko");
};
seq.authenticate().then(onConnexion,onFail);