-
-
Save cldwalker/7896195 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defroutes chapter-routes | |
;; Example story-slug: 42-my-first-story | |
;; Example chapter-slug: 99-introduction | |
;; (util/parse-uid "42-my-first-story") -> 42 | |
;; (util/parse-uid "99-introduction") -> 99 | |
(GET "/chapters/:chapter-slug" [story-slug chapter-slug] | |
(let [story (some-> story-slug util/parse-uid db/find-story-by-uid) | |
chapter (some-> chapter-slug util/parse-uid db/find-chapter-by-uid)] | |
(and story chapter | |
(zizkov.views/show-chapter layout story chapter))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment