mirror of
https://gitea.invidious.io/iv-org/shard-kemal.git
synced 2024-08-15 00:53:36 +00:00
22 lines
458 B
Crystal
22 lines
458 B
Crystal
|
require "option_parser"
|
||
|
require "./frank/*"
|
||
|
|
||
|
$frank_handler = Frank::Handler.new
|
||
|
port = 3000
|
||
|
|
||
|
OptionParser.parse! do |opts|
|
||
|
opts.on("-p ", "--port ", "port") do |opt_port|
|
||
|
port = opt_port.to_i
|
||
|
end
|
||
|
end
|
||
|
|
||
|
at_exit do
|
||
|
handlers = [] of HTTP::Handler
|
||
|
handlers << HTTP::LogHandler.new
|
||
|
handlers << $frank_handler
|
||
|
server = HTTP::Server.new(port, HTTP::Server.build_middleware handlers)
|
||
|
|
||
|
puts "Listening on http://0.0.0.0:#{port}"
|
||
|
server.listen
|
||
|
end
|