parent
808cd318ee
commit
cece28eaf8
@ -1,21 +0,0 @@
|
||||
require 'sinatra/base'
|
||||
require_relative 'cpi_fetcher'
|
||||
|
||||
class App < Sinatra::Base
|
||||
get '/' do
|
||||
current_cpi = fetcher.cpi
|
||||
halt 502 unless current_cpi
|
||||
|
||||
expires 300, :public, :must_revalidate
|
||||
content_type :text
|
||||
"#{current_cpi}\n"
|
||||
end
|
||||
|
||||
run! if app_file == $PROGRAM_FILE
|
||||
|
||||
private
|
||||
|
||||
def fetcher
|
||||
@fetcher ||= CPIFetcher.new
|
||||
end
|
||||
end
|
Loading…
Reference in new issue