Initial commit
This commit is contained in:
23
lib/api/app.rb
Normal file
23
lib/api/app.rb
Normal file
@@ -0,0 +1,23 @@
|
||||
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
|
||||
Reference in New Issue
Block a user