Skip to content
Browse files

convert to rack app so i can play on heroku.

  • Loading branch information...
1 parent d29a937 commit 5480783740c9b2de619fbe3a2383069d8bb23b18 mpd committed
Showing with 27 additions and 0 deletions.
  1. +27 −0 config.ru
View
27 config.ru
@@ -0,0 +1,27 @@
+def process_request
+ begin
+ yield
+ rescue Errno::ENOENT
+ [404, {"Content-Type" => "text/plain"}, "File not found"]
+ rescue Exception
+ [500, {"Content-Type" => "text/plain"}, "Internal server error"]
+ end
+end
+
+run Proc.new { |env|
+ if env["REQUEST_URI"] =~ %r!/([^./]+.jpg)/?\z!
+ process_request do
+ [200, {"Content-Type" => "image/jpeg"}, File.read($1)]
+ end
+ elsif env["REQUEST_URI"] =~ %r!/([^./]+.js)/?\z!
+ process_request do
+ [200, {"Content-Type" => "text/javascript"}, File.read($1)]
+ end
+ else
+ process_request do # probably not strictly necessary.
+ [200, {"Content-Type" => "text/html"}, File.read('heatmap.html')]
+ end
+ end
+}
+
+

0 comments on commit 5480783

Please sign in to comment.
Something went wrong with that request. Please try again.