mirror of
https://github.com/getnamingo/registry.git
synced 2025-08-04 00:31:50 +02:00
Added host view option
This commit is contained in:
parent
de6c67eebb
commit
2d6c2b98eb
3 changed files with 158 additions and 4 deletions
|
@ -52,7 +52,8 @@ $app->group('', function ($route) {
|
|||
|
||||
$route->get('/hosts', HostsController::class .':view')->setName('hosts');
|
||||
$route->map(['GET', 'POST'], '/host/create', HostsController::class . ':create')->setName('hostcreate');
|
||||
|
||||
$route->get('/host/{domain}', HostsController::class . ':viewHost')->setName('viewHost');
|
||||
|
||||
$route->get('/registrars', RegistrarsController::class .':view')->setName('registrars');
|
||||
|
||||
$route->get('/users', UsersController::class .':view')->setName('users');
|
||||
|
@ -199,9 +200,11 @@ $app->add(function (Psr\Http\Message\ServerRequestInterface $request, Psr\Http\S
|
|||
try {
|
||||
return $handler->handle($request);
|
||||
} catch (HttpNotFoundException $e) {
|
||||
$response = new Response();
|
||||
$response->getBody()->write('404 Not Found');
|
||||
return $response->withStatus(404);
|
||||
$responseFactory = new \Nyholm\Psr7\Factory\Psr17Factory();
|
||||
$response = $responseFactory->createResponse();
|
||||
return $response
|
||||
->withHeader('Location', '/')
|
||||
->withStatus(302);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue