Web Development With Clojure: Build Bulletproof Web Apps With Less Code by Dmitri Sotnikov

Web Development With Clojure: Build Bulletproof Web Apps With Less Code by Dmitri Sotnikov

Author:Dmitri Sotnikov
Language: eng
Format: mobi
Tags: Web, Pragmatic Bookshelf, Programming Languages, Lisp, Computers, Programming, General, Web Programming
ISBN: 9781937785642
Publisher: Pragmatic Bookshelf
Published: 2014-01-09T05:00:00+00:00


​ (​ns​ picture-gallery.handler

​ ​..​​.​

​ (:require ​..​​.​ [noir.session :as session]))

picture-gallery-c/src/picture_gallery/handler.clj

​ (​defn​ user-page [_]

​ (session/get :user))

The underscore (_) in the ​user-page​’s arguments vector simply indicates that the argument will be ignored.

We now need to update our handler to set the access rules using the ​:access-rules​ key. The ​app-handler​ will use the ​noir.util.middleware/wrap-access-rules​ middleware to apply the rules to restricted pages. In our case, we have a single rule: the ​user-page​ function.



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.