Skip to content

Commit c747a46

Browse files
committed
update web template
1 parent 1e07efa commit c747a46

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

templates/web/src/Program.php

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,22 +13,17 @@ public static function main(array $args = [])
1313
$builder = WebHost::createDefaultBuilder($args);
1414
$configuration = $builder->Configuration;
1515

16-
$builder->register(function ($services) {
17-
// services
16+
$builder->register(function ($services) use ($configuration) {
17+
// Services
1818
});
1919

2020
$host = $builder->build();
2121

22-
$host->start(function ($app) use ($configuration) {
23-
if ($configuration->getValue('environment') == 'development') {
24-
$app->UseExceptionHandler();
25-
} else {
26-
$app->UseExceptionHandler("/home/error");
27-
}
28-
22+
$host->start(function ($app) {
23+
// Middlewares
2924
$app->useRouter();
30-
// middlewares
3125
$app->useEndpoint(function ($routes) {
26+
// Routes
3227
$routes->mapGet("/", fn () => "Hello World!");
3328
});
3429
});

0 commit comments

Comments
 (0)