Guest User

Untitled

a guest
Apr 24th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.27 KB | None | 0 0
  1. module Rack
  2. class StaticApp
  3. def call(env)
  4. path = env["REQUEST_PATH"]
  5.  
  6. file_path = ::File.join(::File.dirname(__FILE__), "public", path)
  7. ::File.exist?(file_path) ?
  8. [200, {}, ::File.new(file_path, "r")] :
  9. [404, {}, ""]
  10. end
  11. end
  12. end
Add Comment
Please, Sign In to add comment