Added API routes to provide some information for JS; added CoffeeScript to grab benchmark results for a test
This commit is contained in:
23
src/routes/api1.rb
Normal file
23
src/routes/api1.rb
Normal file
@ -0,0 +1,23 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
# /api/v1 routes
|
||||
class GameData < Sinatra::Base
|
||||
|
||||
get '/api/v1/benchmark/details' do
|
||||
benchmark_id = params[:benchmark_id]
|
||||
|
||||
benchmark = Benchmark.where(id: benchmark_id).first()
|
||||
|
||||
json benchmark.values()
|
||||
end
|
||||
|
||||
get '/api/v1/results' do
|
||||
test_id = params[:test_id]
|
||||
benchmark_id = params[:benchmark_id]
|
||||
|
||||
results = Result.where(test_id: test_id, benchmark_id: benchmark_id).all()
|
||||
|
||||
json results.map(&:values)
|
||||
end
|
||||
|
||||
end
|
Reference in New Issue
Block a user