 (defn start-jetty [handler port]
   (jetty/run-jetty handler {:port (Integer. port) :join? false}))
 
-(defrecord Server [db port jetty]
+(defrecord Server [session-store db port jetty]
   component/Lifecycle
   (start [component]
     (println "Start server at port:" port)
-    (assoc component :jetty (start-jetty (app-handler db) port)))
+    (assoc component :jetty (start-jetty (app-handler session-store db) port)))
   (stop [component]
     (println "Stop server")
     (when jetty

            [ring.middleware.params :as params]
            [ring.middleware.edn :refer [wrap-edn-params]]
            [ring.middleware.session :as session]
            [ring.util.response :as response]
            [ring.adapter.jetty :as jetty]
            [compojure.core :refer :all]

     (if (web/logged-in? session)
       (response/redirect "/")
       (web/log-in session)))
   (POST "/login" {params :params session :session}
     (let [user (user/login db (map-keys keyword params))]
       (if-let [error (:error user)]
         (web/error-page session {:error error})
         (-> (response/redirect "/")
             (assoc-in [:session :user] user)))))
   (GET "/logout" _
     (-> (response/redirect "/")
         (assoc :session {})))
   (GET "/signup" {session :session} (web/sign-up session))
   (POST "/signup" {params :params session :session}
     (let [new-user (user/signup! db (map-keys keyword params))]
       (if-let [error (:error new-user)]
         (web/error-page session error)
         (-> (format "/user/%s" (:user/email new-user))
             response/redirect
             (assoc :session {:user new-user})))))
   (POST "/update-pass" {params :params session :session}
     (let [new-user (user/update-password! db (map-keys keyword params))]
       (if-let [error (:error new-user)]
         (web/error-page session error)
         (response/redirect (format "/user/%s" (:user/email new-user))))))
   (GET "/book" {session :session}
     (if-not (web/logged-in? session)
