How to organize a node app that uses sequelize?

后端 未结 10 569
野趣味
野趣味 2020-12-04 04:54

I am looking for an example nodejs app that uses the sequelize ORM.

My main concern is that it seems next to impossible to define your models in separate js files if

10条回答
  •  天命终不由人
    2020-12-04 05:18

    You can import models from other files with sequelize.import http://sequelizejs.com/documentation#models-import

    That way you can have one singleton module for sequelize, which then loads all the other models.

    Actually this answer is quite similar to user1778770`s answer.

提交回复
热议问题