-
-
Save Raynes/7896023 to your computer and use it in GitHub Desktop.
This file contains 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] | |
(when-let [story-uid (util/parse-uid story-slug)] | |
(when-let [chapter-uid (util/parse-uid chapter-slug)] | |
(when-let [story (db/find-story-by-uid story-uid)] | |
(when-let [chapter (db/find-chapter-by-uid chapter-uid)] | |
(-> (zizkov.views/show-chapter story chapter) | |
layout)))))) | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment