class Apiif::Server

Public Instance Methods

serve_file(path, verb) click to toggle source
# File lib/apiif.rb, line 9
def serve_file(path, verb)
  path = File.join(Apiif::OPTIONS[:root], path, "#{verb}.json")

  if !File.exists?(path)
    halt 405 if Dir.exists?(File.dirname(path))
    halt 404
  end

  content_type :json
  File.read(path)
end