24 lines
446 B
Ruby
24 lines
446 B
Ruby
require 'json'
|
|
require 'sinatra/base'
|
|
require_relative '../http/query'
|
|
|
|
module Pruning
|
|
module API
|
|
class App < Sinatra::Base
|
|
before { content_type :json }
|
|
after { serialise_response }
|
|
|
|
private
|
|
|
|
def serialise_response
|
|
return unless content_type == 'application/json'
|
|
response.body = [JSON(response.body)]
|
|
end
|
|
|
|
def query
|
|
Pruning::HTTP::Query.new(params)
|
|
end
|
|
end
|
|
end
|
|
end
|