Determine project root from a running node.js application
There are many ways to approach this, each with their own pros and cons: require.main.filename From http://nodejs.org/api/modules.html: When a file is run directly from Node, require.main is set to its module. That means that you can determine whether a file has been run directly by testing require.main === module Because module provides a filename property … Read more