Esempio n. 1
0
func newBlogHandle(w http.ResponseWriter, req *http.Request) {
	title := req.PostFormValue("title")
	tags := req.Form["tags[]"]
	fmt.Println(tags)
	content := req.PostFormValue("content")
	category, _ := strconv.ParseBool(req.PostFormValue("category"))
	blog.New(title, tags, content, category)
	blog.Generate()
	res, _ := json.Marshal(map[string]string{"status": "success"})
	w.Header().Set("Content-type", "application/json")
	w.Write(res)
}
Esempio n. 2
0
func generateHandle(w http.ResponseWriter, req *http.Request) {
	blog.Generate()
	res, _ := json.Marshal(map[string]string{"status": "success"})
	w.Header().Set("Content-type", "application/json")
	w.Write(res)
}
Esempio n. 3
0
func generate() {
	blog.Generate()
}