mirror of
https://gitea.invidious.io/iv-org/shard-kemal.git
synced 2024-08-15 00:53:36 +00:00
Frank::Handler instance is not a global variable anymore
This commit is contained in:
parent
69ed2d4612
commit
e601730a0c
3 changed files with 4 additions and 4 deletions
|
@ -1,8 +1,6 @@
|
|||
require "option_parser"
|
||||
require "./frank/*"
|
||||
|
||||
$frank_handler = Frank::Handler.new
|
||||
|
||||
at_exit do
|
||||
OptionParser.parse! do |opts|
|
||||
opts.on("-p ", "--port ", "port") do |opt_port|
|
||||
|
@ -14,7 +12,7 @@ at_exit do
|
|||
handlers = [] of HTTP::Handler
|
||||
handlers << HTTP::LogHandler.new
|
||||
handlers << HTTP::StaticFileHandler.new("./public")
|
||||
handlers << $frank_handler
|
||||
handlers << Frank::Handler::INSTANCE
|
||||
server = HTTP::Server.new(config.port, handlers)
|
||||
|
||||
server.ssl = config.ssl
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
def get(path, &block : Frank::Request -> String)
|
||||
$frank_handler.add_route(path, block)
|
||||
Frank::Handler::INSTANCE.add_route(path, block)
|
||||
end
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
require "net/http"
|
||||
|
||||
class Frank::Handler < HTTP::Handler
|
||||
INSTANCE = new
|
||||
|
||||
def initialize
|
||||
@routes = [] of Route
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue