How can I share mongoose models between 2 apps?

后端 未结 6 519
不思量自难忘°
不思量自难忘° 2021-02-04 06:26

I have 2 apps, each in a different folder and they need to share the same models.

I want to symlink the models folder from app A to a models folder in app B.

I\'

6条回答
  •  醉话见心
    2021-02-04 07:00

    If you want to reuse your Mongoose package between other NPM packages, the best way to do it is to install the shared package at the top level app and then use it to initialize the other NPM packages.

    You can use this npm module: https://www.npmjs.com/package/mongoose-global

提交回复
热议问题