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) }
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) }
func generate() { blog.Generate() }