 (definterceptor session-interceptor
   (middlewares/session {:store (cookie/cookie-store)}))
 
+
 ;;==================================================================================
-;
+; retrieve schedule
 ;;==================================================================================
 (defn get-schedule
   "get things by type, ret from peer a list of thing in a new line sep string"
-  [req]
-  ; path segment in req contains request params, /api/:thing, /api/lecture
-  (let [schedid (get-in req [:path-params :schedid])
+  [req]     ; get req, no post data body.
+  ; path segment in req can be parameterized in nested map.
+  (let [schedid (get-in req [:path-params :schedid]) ; nested map under :path-params
         schedule (scheduler/get-schedule schedid)
         result {:status 200 :schedule schedule}
         jsonresp (bootstrap/json-response result)] ; conver to keyword for query

            [io.pedestal.service.http.route.definition :refer [defroutes]]
            [io.pedestal.service.http.sse :refer :all]
            [ring.util.mime-type :as ring-mime]
            [ring.middleware.session.cookie :as cookie])
    (:require [io.pedestal.service.http :as bootstrap]
              [io.pedestal.service.http.route :as route]
              [io.pedestal.service.http.body-params :as body-params]
              [io.pedestal.service.http.route.definition :refer [defroutes]]
              [io.pedestal.service.log :as log]
              [ring.util.response :as ring-resp]
              [minuette.quartzite.scheduler :as scheduler]
    ))

(defn about-page
  [request]

; [[["/order"  ^:interceptors [verify-request] ^:constraints {:user-id #"[0-9]+"}
;    {:get list-orders :post create-order}
;    ["/:id"  ^:constraints {:user-id #"[0-9]+"} ^:interceptors [verify-order-ownership load-order-from-db]
;    {:get view-order :post [:make-an-order o/create-order]}]]]]
;;==================================================================================
(defroutes routes
  [[["/" {:get home-page}
     ; set intermediate interceptors to be executed for before dest-interceptor.
     ^:interceptors [(body-params/body-params) bootstrap/html-body session-interceptor]
     ["/about" {:get about-page}]
     ["/api/schedule/:schedid" {:get get-schedule}]
