title: User.findAll is not a function
body: <p><strong>This is my models/user.js</strong></p>
  
  <pre><code>var sequelize = require('sequelize');
  var bcrypt = require('bcrypt');
  
  module.exports = function(sequelize, DataTypes) {
      const User = sequelize.define('users', {
          user_id: {
              type: DataTypes.INTEGER,
              autoIncrement: true,
              primaryKey: true
          },
          user_name: DataTypes.DATE,
          email: DataTypes.STRING,
          password: DataTypes.STRING
      }, {
          freezeTableName: true,
          instanceMethods: {
              generateHash(password) {
                  return bcrypt.hash(password, bcrypt.genSaltSync(8));
              },
              validPassword(password) {
                  return bcrypt.compare(password, this.password);
              }
          }
      });
  
      return User;
  }
  </code></pre>
  
  <p><strong>This is my models/index.js</strong></p>
  
  <pre><code>module.exports = {
      User: require('./user')
    };
  </code></pre>
  
  <p><strong>This is my UserController.js</strong></p>
  
  <pre><code>var sequelize = require("sequelize");
  var models = require("../models/index");
  
  var userController = {};
  
  // Show list of users
  userController.list = function(req, res) {
   models.User.findAll()
    .then( userResponse =&gt; {
      res.status( 200 ).json( userResponse )
    })
    .catch( error =&gt; {
      res.status( 400 ).send( error )
    });
  };  
  </code></pre>
  
  <p>On executing the above code in localhost it is giving error that "User.findAll is not a function". I have tried in various ways but no result. Need help.
  I am using express - nodejs - Sequelize(mysql2)</p>