示例#1
0
func CategoryCreateHandler(w http.ResponseWriter, r *http.Request) {
	categoryController := controller.Category{}

	//verify user is admin
	adminAuth := auth.Auth{}
	status := adminAuth.VerifyAdmin(r)

	if status == true {

		_, err := categoryController.CreateCategory(r)

		if err != nil {
			log.Println(err)
		} else {
			fmt.Fprint(w, true)
		}
	}
}