diff --git a/controller/image.rb b/controller/image.rb new file mode 100644 index 0000000..3943a41 --- /dev/null +++ b/controller/image.rb @@ -0,0 +1,11 @@ +module Routes + class Images + def self.call(session) + file = "images/#{session.request.path.gsub(/images/, '')}" + return RouteNotFound unless File.exist?(file) + session.response.body = File.read(file) + session.response.content_type = 'image/png' + nil + end + end +end