Separate /db and /queries logic to fix Sinatra validation errors