Create a gist now

Instantly share code, notes, and snippets.

post '/interests' do
# Connect to Redis
uri = URI.parse(ENV["REDIS_URL"] || 'redis://localhost:6379')
REDIS = =>, :port => uri.port, :password => uri.password)
# Parse the JSON body
join = JSON.parse(
# 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment