lazily-require
v0.1.0
Published
Require node.js files from folder lazily. Could be useful in application.
Downloads
3
Maintainers
Readme
lazily-require
Require node.js files from specific path. The file name is mapped to property name. The requirement happened lazily, the module won't be required until it is accessed. Could be useful in application, requirements can be simplified by using in conjunction with approot
Install
Install using npm.
$ npm install lazily-require
Usage
When used in conjunction of approot to initialize the application environment.
var lazy = require('lazily-require');
global.appRoot = require('approot')(__dirname).consolidate();
global.configuration = require(appRoot.config('configuration'));
global.Services = lazy appRoot.services();
global.Routes = lazy appRoot.routes();
global.Records = lazy appRoot.records();
global.Models = lazy appRoot.models();
global.Entities = lazy appRoot.entities();
License
MIT