how to use __dirname in node js code example
Example 1: __dirname javascript
console.log(__dirname) // "/Users/Sam/node-app/cronjobs"
console.log(process.cwd()) // "/Users/Sam/node-app"
Example 2: __dirname javascript
node-app
├──index.js
├──public
├──src
│ ├──helpers.js
│ └──api
│ └──controller.js
├──cronjobs
│ ├──pictures
│ └──hello.js
└──package.json