title: Sequelize - Cannot read property 'list' of undefined
body: <p>Im just learn to use sequelize for my node.js project. For summary my project is ExpressJS+Typescript with Sequelize as ORM and Webpack as module bundler.</p>
  
  <p>Below is my project structure.</p>
  
  <pre><code>src
  -router
  -server
  --config
     config.json
  --controllers
     index.ts
     User.ts
  --migrations
  --models
     index.js
     user.js
  --seeders
   App.ts
   index.ts
  </code></pre>
  
  <p>(sorry can not post picture yet, new user to stackoverflow)</p>
  
  <p>I have build some simple router '/user' and expect it should call the user controller and call sequelize method findAll() from my models module, but the result is its error says <strong>Cannot read property 'list' of undefined</strong>. Below is my code:
  <em>models/index.js</em></p>
  
  <pre><code>const fs = require('fs');
  const path = require('path');
  const Sequelize = require('sequelize');
  const basename = path.basename(module.filename);
  const env = process.env.NODE_ENV || 'development';
  const config = require(`${__dirname}/../config/config.json`)[env];
  const db = {};
  
  let sequelize;
  if (config.use_env_variable) {
    sequelize = new Sequelize(process.env[config.use_env_variable]);
  } else {
    sequelize = new Sequelize(
      config.database, config.username, config.password, config
    );
  }
  
  fs
    .readdirSync(__dirname)
    .filter(file =&gt;
      (file.indexOf('.') !== 0) &amp;&amp;
      (file !== basename) &amp;&amp;
      (file.slice(-3) === '.js'))
    .forEach(file =&gt; {
      const model = sequelize.import(path.join(__dirname, file));
      db[model.name] = model;
    });
  
  Object.keys(db).forEach(modelName =&gt; {
    if (db[modelName].associate) {
      db[modelName].associate(db);
    }
  });
  
  db.sequelize = sequelize;
  db.Sequelize = Sequelize;
  
  export default db;
  </code></pre>
  
  <p><em>models/user.js</em></p>
  
  <pre><code>export default function(sequelize, DataTypes) {
    var user = sequelize.define('user', {
      username: DataTypes.STRING,
      name: DataTypes.STRING,
      email: DataTypes.STRING,
      password: DataTypes.STRING,
      phone: DataTypes.STRING,
      wallet: DataTypes.DECIMAL
    }, {
      classMethods: {
        associate: function(models) {
          // associations can be defined here
          user.hasMany(models.top_up);
        }
      }
    });
    return user;
  };
  </code></pre>
  
  <p><em>controllers/User.ts</em></p>
  
  <pre><code>let user = require('../models').user;
  
  export default {
      list(req, res) {
          return user
          .findAll()
          .then(topUp =&gt; res.status(200).send(topUp))
          .catch(error =&gt; res.status(400).send(error));
      }
  };
  </code></pre>
  
  <p><em>controllers/Index.ts</em></p>
  
  <pre><code>import users from './User'
  
  export default {
      users
  }
  </code></pre>
  
  <p><em>router/router.ts</em></p>
  
  <pre><code>import * as express from 'express';
  
  const userController = require('../server/controllers').users;
  
  // Init express router
  let router = express.Router();
  
  // Setting API URL
  router.get('/', (req, res, next) =&gt; {
      res.json({
          message: 'Hello World!'
      });
  });
  
  router.get('/about',(req, res, next) =&gt; {
      res.send('&lt;p&gt;This is about about&lt;/p&gt;');
  });
  
  router.get('/user', userController.list());
  
  export default router
  </code></pre>
  
  <p>Fyi, all of my project configuration for start express server, typescript compile and webpack bundle is fine already, and the other route for '/' and '/about' is work fine. I know there is something I'm missing, im still new to sequelize, thanks for help.</p>