mirror of
https://github.com/hakanensari/frankfurter.git
synced 2024-10-29 23:32:35 +01:00
31 lines
427 B
Ruby
31 lines
427 B
Ruby
require_relative 'snapshot'
|
|
require 'sinatra'
|
|
require 'sinatra/jsonp'
|
|
require 'yajl'
|
|
|
|
set :root, File.expand_path('..', File.dirname(__FILE__))
|
|
|
|
helpers do
|
|
def snapshot
|
|
Snapshot
|
|
.new(params)
|
|
.quote
|
|
end
|
|
end
|
|
|
|
get '/' do
|
|
File.read File.join 'public', 'index.html'
|
|
end
|
|
|
|
get '/latest' do
|
|
jsonp snapshot
|
|
end
|
|
|
|
get '/:date' do
|
|
jsonp snapshot
|
|
end
|
|
|
|
error do
|
|
"Something is rotten in the state of Denmark."
|
|
end
|