Allow server to start with only fallback defined
PeeHaa opened this issue · 3 comments
Currently the server refuses to start when there are no explicit routes defined.
However when having no explicit routes, but having a fallback defined the server should just start anyway:
$router = new Router();
$router->setFallback($this->auryn->make(FrontController::class));
$server = new Server($this->getServerSockets(), $router, $logger);
yield $server->start();
[2019-10-17T12:10:48.499397+00:00] HttpServer.info: Starting HTTP server
[2019-10-17T12:10:49.525568+00:00] HttpServer.critical: Could not start server
[2019-10-17T12:10:49.526294+00:00] HttpServer.error: Router start failure: no routes registered
I'm fine with this, but I guess it should issue a notice / warning to the logger, because you might as well skip using the router then. PR welcome.
but I guess it should issue a notice / warning to the logger
Yes, agreed. Imo even a router without any routes (not even a fallback handler) should just start the server and emit a warning.
Fine with me, too.