search

Home  >  Q&A  >  body text

javascript - When referencing the table model defined in model, model is undefined.

I use the node express framework and the sequelize model.
There is no problem with the API being referenced in the controller layer, but when the model layer is defined, the printed model is empty

var Models = require('../config/sequelize')

As shown in the figure, the model layer is all table models. I want to add a hook in it. When no data is added to the station table, another table automatically adds a piece of data, similar to the trigger of mysql. However, when running the code, the model It’s always empty,
I’ve been struggling for several days, please help me, thank you

phpcn_u1582phpcn_u15822705 days ago987

reply all(1)I'll reply

  • 巴扎黑

    巴扎黑2017-07-04 13:47:15

    Sequelize Is module.exports exposed

    reply
    0
  • Cancelreply