Class: Apiif::Server

Inherits:
Sinatra::Base
  • Object
show all
Defined in:
lib/apiif.rb

Instance Method Summary collapse

Instance Method Details

#serve_file(path, verb) ⇒ Object



6
7
8
9
10
11
12
# File 'lib/apiif.rb', line 6

def serve_file(path, verb)
  path = File.join('.', path, "#{verb}.json")
  halt 404 if !File.exists?(path)

  content_type :json
  File.read(path)
end