Exemple #1
0
// /user
func userEntityHandler(w http.ResponseWriter, req *http.Request) {
	log.Println("handle")
	switch req.Method {
	case "POST":
		userName := req.FormValue("userName")
		password := req.FormValue("password")
		app.NewUser(userName, password)

		template.Must(template.ParseFiles(
			"templates/_base.html",
			"templates/user/index.html",
		)).Execute(w, app.GetUserList())
	case "GET":
		template.Must(template.ParseFiles(
			"templates/_base.html",
			"templates/user/index.html",
		)).Execute(w, app.GetUserList())
	case "PUT":
	case "DELETE":
	}
}
Exemple #2
0
// /user/*
func userItemHandler(w http.ResponseWriter, req *http.Request) {
	log.Println("handle")
	switch req.Method {
	case "POST":
	case "GET":
		template.Must(template.ParseFiles(
			"templates/_base.html",
			"templates/user/index.html",
		)).Execute(w, app.GetUserList())
	case "PUT":
	case "DELETE":
	}
}