Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- module Rack
- class StaticApp
- def call(env)
- path = env["REQUEST_PATH"]
- file_path = ::File.join(::File.dirname(__FILE__), "public", path)
- ::File.exist?(file_path) ?
- [200, {}, ::File.new(file_path, "r")] :
- [404, {}, ""]
- end
- end
- end
Add Comment
Please, Sign In to add comment