You mostly need to read this thread: File system issue for api / trying to fs.readFileSync dynamically - #11 by hrishikesh