Skip to content

Commit b6ef99c

Browse files
author
Olivier Bonnaure
committed
feat: allow isAPI global variable to handle 404 errors
1 parent 54c714e commit b6ef99c

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

.lua/luaonbeans.lua

+5-1
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,11 @@ function DefineRoute(path, method)
240240
if Params.action == nil then
241241
if RoutePath("/public" .. GetPath()) == false then
242242
SetStatus(404)
243-
Page("404", "app")
243+
if isAPI then
244+
WriteJSON({ error = "404", message = "Not Found" })
245+
else
246+
Page("404", "app")
247+
end
244248
return
245249
end
246250
else

0 commit comments

Comments
 (0)