当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript Sequelize.authenticate函数代码示例

本文整理汇总了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);

        });
开发者ID:christopheGaon,项目名称:test1,代码行数:33,代码来源:server.ts

示例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);
    });
};
开发者ID:endlessdev,项目名称:PortalRank,代码行数:10,代码来源:index.ts

示例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()
{
开发者ID:samuelneff,项目名称:sequelize-learning,代码行数:32,代码来源:app.ts

示例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);



开发者ID:christopheGaon,项目名称:test1,代码行数:25,代码来源:test.ts


注:本文中的Sequelize.authenticate函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。