Skip to content

Commit

Permalink
Support directory index
Browse files Browse the repository at this point in the history
  • Loading branch information
kou committed May 19, 2014
1 parent 1b7fce4 commit 2ba39c2
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion config.ru
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,17 @@ class Uploader
end

file_server = Rack::File.new("public")
directory_server = Rack::Directory.new("public")

application = lambda do |env|
request = Rack::Request.new(env)
response = Rack::Response.new
if request.get?
file_server.call(env)
if request.path.end_with?("/")
directory_server.call(env)
else
file_server.call(env)
end
else
uploader = Uploader.new(request, response)
uploader.run
Expand Down

0 comments on commit 2ba39c2

Please sign in to comment.