Skip to content

Commit

Permalink
Added route to get node
Browse files Browse the repository at this point in the history
  • Loading branch information
Romiko committed Jan 28, 2012
1 parent d0110a0 commit 31e14a7
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions gremlin-endpoint.rb
Expand Up @@ -26,6 +26,11 @@
ReplaceHostNameWithProxyHostName(response)
end

get '/db/data/node/:nodeid' do
response = RestClient.get ENV['NEO4J_URL'] + '/db/data/node/' + params[:nodeid], {:content_type => :json, :accept => :json}
ReplaceHostNameWithProxyHostName(response)
end

get '/db/data/node/:nodeid/relationships/:relationships' do
response = RestClient.get ENV['NEO4J_URL'] + '/db/data/node/' + params[:nodeid] + '/relationships/' + params[:relationships], {:content_type => :json, :accept => :json}
ReplaceHostNameWithProxyHostName(response)
Expand Down Expand Up @@ -82,6 +87,8 @@
end
end

# functions

def ReplaceHostNameWithProxyHostName(response)
response.gsub(/(http:\/\/\w+\W*.*\/db\/data)/, "http://" + ENV['APP_NAME'] + ".heroku.com/db/data")
end

0 comments on commit 31e14a7

Please sign in to comment.