nequire
Requires files by namespaces.
Getting Started
Install the module with: npm install nequire
var nequire = ; nequire; ; // require module ./helper/math/pi.js
Documentation
Configuration
To use nequire
you must call the configure
method which expect a map of namespaces.
map
- Type:
Object
- Default: An empty
Object
The map contains the namespaces which will be made available. A key of the object is a namespace and the value is the associated path where the modules are located.
Usage examples
This is a simple webserver example which use nequire
.
index.js
// load nequirevar nequire = http = ; // configure the namespacesnequire;// make nequire global availablenequire; // use nequire to load the routesvar users = ;var status404 = ; // create servervar server = http;// start serverserver;
user.js
// use nequire to load the user modelvar User = ; // exports route handlermodule { User;};
Contributing
In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using Grunt.
License
Copyright (c) 2014 Florian Goße. Licensed under the MIT license.