 app.post "/communities/:community/join", (req, res) ->
   community = req.params.community
   ghAdmin = github.client nconf.get "GIHUB_ADMIN_TOKEN"
-  ghAdmin.get "/orgs/communities/teams", (err, status, teams) ->
+  getGitHubTeams (err, teams) ->
+    if err
+      res.send 500, { error: "API call failed" }
+      return
     console.log("teams", teams);
     membersTeam = team for team in teams when team.name == "#{community}-members"
     console.log "membersTeam", membersTeam

        return      
      res.json resp

# app.get "/communities/:community/members", (req, res) ->
#   community = req.params.community
#   getMembers community, (err, members) ->
#     if err
#       res.send 500, { error: "API call failed" }
#       return
#     res.json members

app.post "/communities/:community", (req, res) ->
  community = req.params.community
  ghAdmin = github.client nconf.get "GIHUB_ADMIN_TOKEN"

        

getMembers = (community, callback) ->
  getGitHubTeams (err, teams) ->
    console.log("teams", teams);
    if err 
      callback err
