Skip to content

Instantly share code, notes, and snippets.

@remogatto
Created July 19, 2011 16:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save remogatto/1092983 to your computer and use it in GitHub Desktop.
Save remogatto/1092983 to your computer and use it in GitHub Desktop.
func HomeHandler(w http.ResponseWriter, req *http.Request) *Error {
if login, accessToken := getUserInfoFromCookie(req); login != "" && accessToken != "" {
api := NewGithubAPI(login, accessToken)
if gists, err := api.ListGists(); err != nil {
return &Error{err, "Internal server error", 500}
} else {
w.(*Template).Data = map[string]interface{}{"login": login, "gists": gists}
return nil
}
}
http.ServeFile(w, req, "public/index.html")
return nil
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment