offimic/ruby/offimic-api

19 lines
297 B
Text
Raw Normal View History

2018-04-12 14:00:52 +00:00
#!/usr/bin/env ruby
require 'sinatra'
require 'date'
get '/history' do
File.open('history.csv', 'r') do |fh|
fh.read
end
end
get '/count/:value' do
value = params[:value]
dt = DateTime.now
File.open('history.csv', 'a') do |fh|
fh.puts "#{dt.rfc3339}, #{value}"
end
end