Index
Overview


It is suggested to use the install approach over this approach. Using "npm link" is much more tedious -- i.e., driven manually.

We'll want to test our module locally before publishing to npm. This page provides a step-by-step on how to do it.

Steps


Given

  • src = a source (provider) local node.js module named url-wrapper
  • client = a client (user/consumer) local node.js module


Navigate to Source Module
Navigate to the source (provider) module and then do the command shown here.
> npm link
Navigate to Client Module
Navigate to the client (consumer) module and then do the command shown here.
> npm link url-wrapper
Client Configuration
Client module package.json file does not need to include url-wrapper.

It only needs to require module in the usual way, as shown here.
const UrlWrapper = require('url-wrapper').UrlWrapper;
Run Client
Open CLI on client directory and run the command shown (assuming runnable module is named 'play').
> node play
In Browser
In browser, enter a URL similar to those shown.

Note that this URL is specific to the url-wrapper module.
http://localhost:3000/wow/hey/play?width=8&height=7

http://localhost:3000/wow/hey/play?width=wide%20indeed&height=really%20high


Download Example


These downloads demo testing locally using the project jsUnit.