D
D
Dvorak2016-08-16 22:26:32
MySQL
Dvorak, 2016-08-16 22:26:32

Why can't call a method when using Sequelize?

const Sequelize = require('sequelize'),
      sequelize = new Sequelize('first', 'mak', 'pass', {
        dialect: 'mysql',
        host: 'localhost'
      });

sequelize
  .authenticate()
  .complete((err) => {
    if (err) {
      console.log('Ошибка подключения');
      throw err;
    } else {
      console.log('Соединение установлено');
      sequelize
        .query('SELECT * FROM band', null, {raw: true})
        .success((el) => {
          console.log(el);
        });
    }
  })

In the console I see sequelize.authenticate(...).complete is not a function. Code taken from Sukhov's book on node.js

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vitaly, 2016-08-16
@allishappy

stackoverflow.com/questions/29977855/sequelize-aut...
The link says that this function returns a promise in the new version, forget about books, read the documentation for the software.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question