示例#1
0
func article(args []string) {
	if len(args) == 0 {
		help("new")
		return
	}
	title := args[0]
	blog.New(title, []string{}, "", false)
}
示例#2
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)
}