From e80c3a1c5a8a34350c8ab262ff64bbf5d81d0b12 Mon Sep 17 00:00:00 2001 From: Paul Nettleton Date: Tue, 29 Nov 2022 12:04:45 -0600 Subject: [PATCH] Update AuthorController.js to respond with objects Changes: - `search` (GET /api/authors/search) --- server/controllers/AuthorController.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/server/controllers/AuthorController.js b/server/controllers/AuthorController.js index 70e67bdd..eb0d605e 100644 --- a/server/controllers/AuthorController.js +++ b/server/controllers/AuthorController.js @@ -148,7 +148,9 @@ class AuthorController { var limit = (req.query.limit && !isNaN(req.query.limit)) ? Number(req.query.limit) : 25 var authors = this.db.authors.filter(au => au.name.toLowerCase().includes(q)) authors = authors.slice(0, limit) - res.json(authors) + res.json({ + results: authors + }) } async match(req, res) {