func Auth(h http.Handler) http.Handler { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { user := model.CurrentUser(r) if user != nil { h.ServeHTTP(w, r) return } w.WriteHeader(http.StatusUnauthorized) }) }
func GetMeHandler(w http.ResponseWriter, r *http.Request) { user := model.CurrentUser(r) httpres.Json(w, http.StatusOK, UserResponse{*user}) }