From a335471f020c30a50ad0596d61ea0dae9ab92aec Mon Sep 17 00:00:00 2001 From: Joey Baker Date: Tue, 1 Nov 2016 17:39:16 -0700 Subject: [PATCH] Fix(crud/list) 404 on no results --- src/crud.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/crud.js b/src/crud.js index 1f02710..be5cc6a 100644 --- a/src/crud.js +++ b/src/crud.js @@ -165,6 +165,8 @@ export const list = ({ server, model, prefix = '/', config }) => { where, include, limit, offset, order, }); + if (!list.length) return void reply(notFound('Nothing found.')); + reply(list.map((item) => item.toJSON())); },