require 'sinatra' require 'nokogiri' require 'open-uri' require 'sinatra/json' require 'json' # sets the view directory correctly (to make it work with gists) set :views, Proc.new { File.dirname(__FILE__) } get '/' do erb :json end get '/jsonp' do erb :jsonp end get '/sample' do "hello world Another link has appeared" end get '/acronym/:acronym' do open("http://www.nactem.ac.uk/software/acromine/dictionary.py?sf=#{params[:acronym]}") do |f| response = { :content => JSON.parse(f.read), } return json response end end