Improve kemal.cr

This commit is contained in:
Sdogruyol 2016-02-14 15:15:28 +02:00
parent fe10d210c3
commit 092f5a2e49
13 changed files with 13 additions and 24 deletions

View file

@ -5,9 +5,8 @@ at_exit do
Kemal::CLI.new
config = Kemal.config
config.setup_logging
config.logger.write "[#{config.env}] Kemal is ready to lead at #{config.scheme}://#{config.host_binding}:#{config.port}\n"
config.add_handler Kemal::StaticFileHandler.new(config.public_folder)
config.setup_error_handler
config.add_handler Kemal::StaticFileHandler.new(config.public_folder)
config.add_handler Kemal::RouteHandler::INSTANCE
server = HTTP::Server.new(config.host_binding.not_nil!.to_slice, config.port, config.handlers)
@ -31,6 +30,7 @@ at_exit do
end
end
end
config.logger.write "[#{config.env}] Kemal is ready to lead at #{config.scheme}://#{config.host_binding}:#{config.port}\n"
server.listen
end