local-lib
Node.js require
your local library files/modules easily from anywhere in
your project without having to navigate directories.
painful
var db = ;
the local-lib way
var db = db;
Installation
npm install local-lib
Usage
- add a
lib
orlibrary
folder in your project root. - add
.js
files,.json
files, or module folders to your library - access your library easily using global require
Library folders should contain an index.js
to export your library,
or a package.json
file with a main
directive to point to your main file.
Example
project structure
project root
├── lib
│ ├── utils
│ │ └── index.js
│ └── db.js
└── app.js
app.js
var lib = ; var db = libdb; var utils = libutils;
or
var db = db;