Update AuthorController.js to respond with objects

Changes:
- `search` (GET /api/authors/search)
This commit is contained in:
Paul Nettleton 2022-11-29 12:04:45 -06:00
parent e04d26307e
commit e80c3a1c5a

View File

@ -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) {