sequelize.import is not a function

后端 未结 3 816
梦毁少年i
梦毁少年i 2021-02-13 04:33

I\'m new to express.

I want to import files to sequelize and declared:

const model = sequelize.import(path.join(__dirname, file))

                                 


        
3条回答
  •  花落未央
    2021-02-13 04:54

    Check if you have exported the model using old JavaScript syntax.

    In my case, it was enough to change the code from:

    export default (sequelize, DataTypes) => {
        ...
    }
    

    to

    module.exports = (sequelize, DataTypes) => {
        ...
    }
    

提交回复
热议问题