From b8f74e1c98258e0e76ed0a80e967f28edde156ed Mon Sep 17 00:00:00 2001 From: Paul Nettleton Date: Tue, 29 Nov 2022 11:48:21 -0600 Subject: [PATCH] Update CollectionController.js to respond with objects Changes: - `findAll` (GET /api/collections) --- server/controllers/CollectionController.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/server/controllers/CollectionController.js b/server/controllers/CollectionController.js index 9234abee..a00ae867 100644 --- a/server/controllers/CollectionController.js +++ b/server/controllers/CollectionController.js @@ -20,8 +20,9 @@ class CollectionController { } findAll(req, res) { - var expandedCollections = this.db.collections.map(c => c.toJSONExpanded(this.db.libraryItems)) - res.json(expandedCollections) + res.json({ + collections: this.db.collections.map(c => c.toJSONExpanded(this.db.libraryItems)) + }) } findOne(req, res) {