Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including getmodule with all npm packages installed. Try it out:

var getmodule = require("getmodule")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

getmodule v1.0.0

Include local modules relative to your root path

Get Module

Include local NodeJS modules relative to your root path

Get Module

NPM version Build Status Coverage Status Code Climate



npm i --save getmodule


Add getmodule on top of your app.js (or main file of your app):

require( 'getmodule' );

Now, you can call any module based on root path of your application.

If your module is on app/modules/mymodule.js, but you're calling it on the file app/controllers/controller.js; in tradicional mode, you needed to do:

var mymodule = require( '../modules/mymodule' );

But with getmodule, you just need type this:

var mymodule = getmodule( 'app/modules/mymodule' );




MIT License © Fernando Daciuk

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free