In Laravel you can show a 404 page just on creating a file 404.blade.php
in the errors folder according to this answer.
But how can I return a custom response in my Lumen API if the entered request don't match any of mine in web.php
. So something like:
// ...
$router->default(function () {
return response()->json(['error' => 'INVALID_ROUTE'], 404);
});