Reputation: 397
I have two node.js (more specifically, express.js) projects. Lets consider "project A" which is the main project, and "project B" which is an "ad-hoc" (for a certain purpose) project. Project B needs project A models.
How to re-use project A's models wisely without repeating code? (And how is it working practically, in terms of how the two projects are arranged?)
Thanks.
Upvotes: 0
Views: 201
Reputation: 43243
A decent approach to deal with this would be to separate it as a module you can install using npm
. (You can install private packages with it)
This would allow you to easily manage any dependencies your library has. You can define them into the package.json
file, and whenever a project needs the library, you simply install it and npm
deals with the dependencies.
Upvotes: 3