When developing a node.js application with custom libraries, dealing with relative pathing in your requires can become irritating. It requires (heh) that you evaluate where you are in the project’s directory structure for each reaference. I’ve found that always using absolute paths simplifies the process and avoids accidental reference errors, especially when copying and pasting a commonly used utility library.

So instead of this:

You can do this:

The built in node.js function process.cwd() returns the root directory of your application. Using backticks and the template literal string interpolation provided by ES2015 cleans up the code and eliminates the need for an ugly string concatenation.

Now you can copy and paste your references with abandon and know that they will always work. Lazy and fun.