title: findAll is not a function
body: <p>I'm building a sample app based on this <a href="https://github.com/sequelize/express-example" rel="nofollow">sequelize example</a>.</p>
  
  <p>I'm getting the following error:</p>
  
  <blockquote>
    <p>TypeError: models.User.findAll.then is not a function</p>
  </blockquote>
  
  <p><strong>config/config.json</strong></p>
  
  <pre><code>{
    "development": {
      "username": "postgres",
      "password": "root",
      "database": "test",
      "host": "127.0.0.1",
      "dialect": "postgres",
      "port": "5432"
    }
  ...same for test &amp; production
  </code></pre>
  
  <p><strong>controllers/user.js</strong></p>
  
  <pre><code>var express = require('express');
  var router = express.Router();
  var models = require('../models');
  
  router.get('api/user', function (req, res) {
      models.User.findAll.then(function(users) {
          res.json(users);
      });
  });
  </code></pre>
  
  <p><strong>models/User.js</strong></p>
  
  <pre><code>"use strict";
  module.exports = function(sequelize, DataTypes) {
      var User = sequelize.define("User", {
          id : {
              type : DataTypes.INTEGER,
              primaryKey: true,
              allowNull : false,
          },
          name : {
              type : DataTypes.STRING,
              allowNull : false,
          },
          email : {
              type : DataTypes.STRING,
              allowNull : false,
          },
          role : {
              type : DataTypes.INTEGER,
              allowNull : false,
          }
      }, {
          tableName: 'user'
      });
      return User;
  };
  </code></pre>
  
  <p><strong>models/index.js</strong> is essentially the same as in the github repo</p>
  
  <pre><code>"use strict";
  
  var fs = require("fs");
  var path = require("path");
  var Sequelize = require("sequelize");
  var env = process.env.NODE_ENV || "development";
  var config = require(__dirname + '/../config/config.json')[env];
  var sequelize = new Sequelize(config.database, config.username, config.password, config);
  
  var db = {};
  
  fs.readdirSync(__dirname).filter(function(file) {
      return (file.indexOf(".") !== 0) &amp;&amp; (file !== "index.js");
  }).forEach(function(file) {
      var model = sequelize["import"](path.join(__dirname, file));
      db[model.name] = model;
  });
  
  Object.keys(db).forEach(function(modelName) {
      if ("associate" in db[modelName]) {
          db[modelName].associate(db);
      }
  });
  
  db.sequelize = sequelize;
  db.Sequelize = Sequelize;
  
  module.exports = db;
  </code></pre>