Skip to content

Instantly share code, notes, and snippets.

@pelted
Created January 3, 2012 17:53
Show Gist options
  • Save pelted/1556078 to your computer and use it in GitHub Desktop.
Save pelted/1556078 to your computer and use it in GitHub Desktop.
Sinatra request with RestClient to API in same rack app
#config.ru
...
map "/api" do
run MyApi
end
map "/" do
run MyApp
end
#my-app.rb
...
get '/people/?' do
## This causes request to this route to time out however if send a request directly to
## http://127.0.0.1:9393/api/people then no problem. The API is correct.
@results = RestClient.get "http://127.0.0.1:9393/api/people", {:accept => :json}
erb :people
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment