Beispiel #1
0
func (s *Server) loginHandler(w http.ResponseWriter, r *http.Request) {
	fmt.Println("loginHandler")
	//session, _ := s.sessionStore.Get(r, "auth")

	buf, err := assets.Asset("index.html")

	if err != nil {
		http.Error(w, err.Error(), http.StatusInternalServerError)
		return
	}

	w.Write(buf)
}
Beispiel #2
0
func (s *Server) assetHandler(w http.ResponseWriter, r *http.Request) {
	assetName := mux.Vars(r)["asset"]
	fmt.Printf("url=%s asset=%s\n", r.URL.String(), assetName)

	buf, err := assets.Asset(assetName)

	if err != nil {
		http.Error(w, err.Error(), http.StatusNotFound)
		return
	}

	w.Write(buf)
}