In my project of node.js which is a ES module(as I have used “type”: “module” in package.JSON file) I am trying to render HTML file and image file which is stored in a “public” folder. When I am using app.use(express.static(‘public’)) and app.get(‘index.html’,{root:__dirname}). I am getting error
Error: __dirname is not defined
Click below to sign up and get $100 of credit to try our products over 60 days!