mirror of
https://github.com/hakanensari/frankfurter.git
synced 2024-11-22 11:02:30 +01:00
26 lines
336 B
Ruby
26 lines
336 B
Ruby
require_relative 'snapshot'
|
|
require 'sinatra'
|
|
require 'sinatra/jsonp'
|
|
|
|
helpers do
|
|
def base
|
|
params[:base] || 'EUR'
|
|
end
|
|
end
|
|
|
|
get '/' do
|
|
File.read File.join 'public', 'index.html'
|
|
end
|
|
|
|
get '/latest' do
|
|
jsonp Snapshot
|
|
.last
|
|
.to_base base
|
|
end
|
|
|
|
get '/:date' do |date|
|
|
jsonp Snapshot
|
|
.new(date)
|
|
.to_base base
|
|
end
|