Sha256: 6f3b42d43633671fe6209b70fe860576db17cfc2d6aefca70d4df2c5a39c385f
Contents?: true
Size: 558 Bytes
Versions: 11
Compression:
Stored size: 558 Bytes
Contents
require 'sinatra/base' require 'animal_service/animal_repository' module AnimalService class Api < Sinatra::Base set :raise_errors, false set :show_exceptions, false error do e = env['sinatra.error'] content_type :json status 500 {:error => e.message, :backtrace => e.backtrace}.to_json end get '/alligators/:name' do if (alligator = AnimalRepository.find_alligator_by_name(params[:name])) content_type :json alligator.to_json else status 404 end end end end
Version data entries
11 entries across 11 versions & 1 rubygems