I have multiple json files under a folder that I need to read. The data file path is like:
./data/json1.json
./data/json2.json
My initializer class works as below:
const j1 = require('./data/json1.json');
const j2 = require('./data/json2.json');
init(){
return j1.concat(j2);
}
Is there a better way to do this as the list of files under data could increase and every time this would require modifications?
I would preferably avoid a solution with looping in the folder and read file to append in an array object in init().