本文整理匯總了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);