Skip to content

Commit a7742e9

Browse files
committed
Update items get api
1 parent 0524b03 commit a7742e9

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

server/app.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ const path = require("path");
88

99
const scrapeDynamicWebpage = require("./scrapers/dynamincSiteScraper");
1010
const scrapeStaticWebpage = require("./scrapers/staticSiteScraper");
11-
// const data = require("./data/itemsData.json");
1211

1312
var folder = "./data";
1413

@@ -26,11 +25,11 @@ app.get("/api/v1/items", function (req, res) {
2625
console.error(err);
2726
res.status(500).send(err);
2827
} else {
29-
let data = {};
28+
let data = [];
3029
files.forEach((file) => {
3130
const filePath = path.join("./data", file);
3231
const fileData = JSON.parse(fs.readFileSync(filePath, "utf8"));
33-
data[file] = fileData;
32+
data = data.concat(fileData);
3433
});
3534
res.json(data);
3635
}

0 commit comments

Comments
 (0)