コード例 #1
0
ファイル: server.go プロジェクト: gssdromen/goblog
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)
}
コード例 #2
0
ファイル: server.go プロジェクト: gssdromen/goblog
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)
}
コード例 #3
0
ファイル: command.go プロジェクト: gssdromen/goblog
func generate() {
	blog.Generate()
}