I have a node.js application that uses a static csv file that i build some values from. My project structure is as follows:
/-- <app>
/-- -- sampledata.csv
/-- -- <server>
/-- -- -- server.js
the way i refer to this file through server.js is:
path.join(__dirname, "..", "sampledata.csv")
when i try reading the file:
fs.readFile(path.join(__dirname, "..", "sampledata.csv"), "utf8", (err, data) => {
//code
}
I get the error
Cannot destructure property `data` of 'undefined' or 'null'.
Can anyone tell me how to point to the right location in the directory as i think it's using the path as the string name?