
How to print or get the root project folder path while coding in express JS. The root folder is the main project folder where the domainame.com/ points to.
__dirname is express used to get the root directory.
Eg: console.log(__dirname);
const express = require("express");
const app = express();
app.get("/", function(req, res){
console.log(__dirname);
//gets the root directory
});
app.listen(4000, function(){
console.log("Server started at port 4000");
});
