shard-kemal/src/frank.cr
2014-07-30 19:17:53 -03:00

24 lines
570 B
Crystal

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|
Frank.config.port = opt_port.to_i
end
end
config = Frank.config
handlers = [] of HTTP::Handler
handlers << HTTP::LogHandler.new
handlers << HTTP::StaticFileHandler.new("./public")
handlers << $frank_handler
server = HTTP::Server.new(config.port, handlers)
server.ssl = config.ssl
puts "Listening on #{config.scheme}://0.0.0.0:#{config.port}"
server.listen
end