-
-
Save JSoon/75b16d67395575066415f95f03076b1b to your computer and use it in GitHub Desktop.
Get root path of node.js application
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var path = require('path'); | |
| module.exports = (function () { | |
| return path.dirname(require.main.filename || process.mainModule.filename); | |
| })(); | |
| // Example of usage: | |
| var root = require('root'); // In root will be absolute path to your application |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment