Skip to content
This repository was archived by the owner on Oct 8, 2024. It is now read-only.

Commit 29b82b1

Browse files
committed
feat: update routes to work with new modules
1 parent c8f7a03 commit 29b82b1

File tree

1 file changed

+25
-14
lines changed

1 file changed

+25
-14
lines changed

app/routes/index.php

Lines changed: 25 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,29 +5,27 @@
55
| Set up 404 handler
66
|--------------------------------------------------------------------------
77
|
8-
| Create a handler for 404 errors
8+
| Leaf provides a default 404 page, but you can also create your
9+
| own 404 handler by calling app()->set404(). Whatever function
10+
| you set will be called when a 404 error is encountered
911
|
1012
*/
1113
app()->set404(function () {
12-
response()->json("Resource not found", 404, true);
14+
response()->json('Resource not found', 404, true);
1315
});
1416

1517
/*
1618
|--------------------------------------------------------------------------
1719
| Set up 500 handler
1820
|--------------------------------------------------------------------------
1921
|
20-
| Create a handler for error 500
22+
| Leaf provides a default 500 page, but you can create your own error
23+
| 500 handler by calling the setErrorHandler() method. The function
24+
| you set will be called when a 500 error is encountered
2125
|
2226
*/
23-
app()->setErrorHandler(function ($e = null) {
24-
if ($e) {
25-
if (app()->config("log.enabled")) {
26-
app()->logger()->error($e);
27-
}
28-
}
29-
30-
response()->json("An error occured, our team has been notified", 500, true);
27+
app()->setErrorHandler(function () {
28+
response()->json('An error occured, our team has been notified', 500, true);
3129
});
3230

3331
/*
@@ -39,7 +37,20 @@
3937
| the controller namespace first.
4038
|
4139
*/
42-
app()->setNamespace("\App\Controllers");
40+
app()->setNamespace('\App\Controllers');
4341

44-
// You can break up routes into individual files
45-
require __DIR__ . "/_app.php";
42+
/*
43+
|--------------------------------------------------------------------------
44+
| Your application routes
45+
|--------------------------------------------------------------------------
46+
|
47+
| Leaf MVC automatically loads all files in the routes folder that
48+
| start with "_". We call these files route partials. An example
49+
| partial has been created for you.
50+
|
51+
| If you want to manually load routes, you can
52+
| create a file that doesn't start with "_" and manually require
53+
| it here like so:
54+
|
55+
*/
56+
// require __DIR__ . '/custom-route.php';

0 commit comments

Comments
 (0)