I\'m new with NodeJs, my project is growing and i dont want make relative imports, i want imports like these installed from npm.
I have the following directory structure
This topic is extensively discussed here. My conclusion is mostly:
app/users/user.js
and app/users/user.test.js
.node_modules/app
that points to ../app
so I can require('app/users');
from anywhere in the code base.There is nothing which says you cannot put your own code inside node_modules. This will enable you to reference it as you want. If you have a .gitignore or equivalent preventing code inside node_modules from being committed, you can add exceptions for your own code.
node_modules
!node_modules/model/