Commit unstaged changes

This commit is contained in:
heyarne 2022-02-19 19:35:51 +01:00
commit e730a5cc5e
2 changed files with 12 additions and 11 deletions

View file

@ -18,23 +18,24 @@
(io/copy (-> file :tempfile) (io/file (str filename "." img-ext)))
(spit (str filename ".json") predictions)))
(defn upload-handler [req]
;; TODO: Verify params
(let [{:keys [snapshot predictions]} (-> req :params)]
(upload! snapshot predictions)
{:status 201
:body "Thanks :)"}))
(def app
(ring/ring-handler
(ring/router
[["/upload"
;; TODO: Verify params
{:post (fn [req]
(let [{:keys [snapshot predictions]} (-> req :params)]
(upload! snapshot predictions)
{:status 201
:body "Thanks :)"}))}]
[["/upload" {:post upload-handler}]
["/*" (ring/create-resource-handler)]]
{:conflicts (constantly nil)})))
(defonce server (atom nil))
(defn stop-server []
(when-not (nil? @server)
(when @server
(println "Stopping server…")
(@server :timeout 100)
(reset! server nil)))