Search code examples
databasenode.jsencapsulationnpm

Node.js - Package Database Calls With NPM or In Module


I was recently interviewed by a technical architect and he mentioned that his group has begun to consolidate all domain-based database calls into packages. He said this had significant advantages when sharing code and devising TDD (should.js). Is this a recommended practice? What are the advantages/disadvantages of using packages for encapsulating such resource IO? Please include links, if available. Thanks.


Solution

  • You can use npm packages to share code between projects since that's what packages do. Starting out with a package is probably a bad idea. You mostly start with a module and if needed extract out a package.