To read a file located in the document root of the sails project I currently use an absolute path.
/var/www/project/file.conf
How can I get the document root path in sails? Or how can I read the file in a controller by using relative path?
in Sails the root path is: sails.config.appPath
Since the main application file is app.js
in the root folder, process.cwd()
should work just fine for you.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With