Created
February 12, 2012 20:02
-
-
Save mikepack/1810540 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
post '/interests' do | |
# Connect to Redis | |
uri = URI.parse(ENV["REDIS_URL"] || 'redis://localhost:6379') | |
REDIS = Redis.new(:host => uri.host, :port => uri.port, :password => uri.password) | |
# Parse the JSON body | |
join = JSON.parse(request.body.read) | |
# Register the user's interest in an artist | |
REDIS.sadd("artists:#{join['artist_id']}", join['user_id']) | |
REDIS.sadd("users:#{join['user_id']}", join['artist_id']) | |
status 201 | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment