kemal/src/frank.cr
Zamith 8cf04b58ca
Move static file handler to be called after the instance handler
This way only routes that are not caught by the instance handler will go
through to the static file handler.
2015-01-31 14:39:50 +00:00

22 lines
543 B
Crystal

require "option_parser"
require "./frank/*"
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 << Frank::Handler::INSTANCE
handlers << HTTP::StaticFileHandler.new("./public")
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