call backend to create snippt
This commit is contained in:
parent
ad56963220
commit
f2e435b777
3 changed files with 29 additions and 2 deletions
|
|
@ -2,8 +2,15 @@
|
|||
(:require
|
||||
[cli-cms.cli-utils :as utils]
|
||||
[clojure.string :as str]
|
||||
[babashka.http-client :as http]
|
||||
[cheshire.core :as json]
|
||||
[babashka.process :refer [shell]]))
|
||||
|
||||
(defn create-snippet [{:keys [title slug markdown tags]}]
|
||||
(http/post "http://localhost:8080/api/snippet"
|
||||
{:headers {:content-type "application/json"}
|
||||
:body (json/encode {:title title :slug slug :markdown markdown :tags tags})}))
|
||||
|
||||
(defn run []
|
||||
(let [title (utils/prompt-for "title")
|
||||
slug (utils/prompt-for "slug")
|
||||
|
|
@ -13,4 +20,5 @@
|
|||
;; (println "Please enter a title:")
|
||||
(println (format "TODO: create post with title: %s and slug %s" title slug))
|
||||
(println tags)
|
||||
(println markdown)))
|
||||
(println markdown)
|
||||
(create-snippet {:title title :slug slug :markdown markdown :tags tags})))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue