<commit_before>(ns one-route.core
  (:require [compojure.handler :as handler]
            [compojure.core
             :as c-core
             :refer [defroutes GET POST PUT DELETE HEAD OPTIONS PATCH ANY]]
            [compojure.route :as c-route]
            [ring.server.standalone :as server]
            [ring.middleware.json :as ring-json]))

(defroutes api
  (GET "/" [] (slurp "resources/public/html/index.html"))
  (c-route/resources "/"))

(defn app []
  (-> (handler/api api)
    (ring-json/wrap-json-body {:keywords? true})
    (ring-json/wrap-json-response)))

(defn start-server []
  (server/serve (app) {:port 8070
                       :open-browser? false}))<commit_msg>added PUT and GET routes<commit_after>(ns one-route.core
  (:use [ring.middleware.reload]
        [ring.util.response])
  (:require [compojure.handler :as handler]
            [compojure.core
             :as c-core
             :refer [defroutes GET POST PUT DELETE HEAD OPTIONS PATCH ANY]]
            [compojure.route :as c-route]
            [ring.server.standalone :as server]
            [ring.middleware.json :as ring-json]))

(def user-table (atom [{:name "mathieu" :team "SRP"}
                       {:name "Mike" :team "Giraffe"}]))

(defroutes api
  (GET "/" [] (slurp "resources/public/html/index.html"))
  (GET "/entry/:name" [name] (response (filter (fn [{n :name}] (= n name )) @user-table)))
  (PUT "/entry" {newuser :body} (response (do (println newuser) (swap! user-table (fn [u] (conj u newuser))) @user-table)))
  (c-route/resources "/"))

;;
(def app
  (->
    (var api)
    (handler/api)
    (wrap-reload '(one-route.core))
    (ring-json/wrap-json-body {:keywords? true})
    (ring-json/wrap-json-response)))

(defn start-server []
  (server/serve (var app) {:port 8070
                           :join? false
                       :open-browser? false}))


;;(def server (start-server))

;;(.stop server)


;;(macroexpand '(GET "/entry/:name" [name] (do (println "my test") "hello world")))

{'fraction_non_alphanumeric': 0.17015968063872255, 'fraction_numerical': 0.003992015968063872, 'mean_word_length': 2.4450171821305844, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2606121', 'n_tokens_mistral': 703, 'n_tokens_neox': 673, 'n_words': 165}