Last active
August 29, 2015 14:00
-
-
Save andreasronge/11189170 to your computer and use it in GitHub Desktop.
Example how to deploy Neo4j.rb / neo4j-core app on heroku
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
source "https://rubygems.org" | |
ruby "2.1.1" | |
gem 'sinatra', '1.1.0' | |
gem 'neo4j-core', '3.0.0.alpha.11' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
web: bundle exec ruby web.rb -p $PORT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'sinatra' | |
require 'neo4j-core' | |
neo4j_url = ENV['GRAPHENEDB_URL'] || 'http://localhost:7474' | |
uri = URI.parse(neo4j_url) | |
server_url = "http://#{uri.host}:#{uri.port}" | |
Neo4j::Session.open(:server_db, server_url, basic_auth: { username: uri.user, password: uri.password}) | |
get '/' do | |
n = Neo4j::Node.create({name: 'andreas'}, :person) | |
"Hello, world #{n[:name]}" | |
end |
<3 thanks!
i tweaked mine to use uri.scheme too so I can handle http vs https.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
heroku addons:add graphenedb
For a rails and neo4j example, see https://github.com/andreasronge/neo4j/tree/master/example/blog