TypeError: Cannot read property 'findAll' of undefined (expressjs).
All functions (sequelize) are not working. All errors: Cannot read property 'sequelize method' ...
module.exports = function (sequelize, DataTypes) {
var User = sequelize.define('user', {
email: {type: DataTypes.STRING(32), unique: true, allowNull: false},
});
return User;
};
Controller:
models = require('./../models');
exports.index = function (request, response, next) {
models.User.findAll({attributes: ['id', 'username']});
};