This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-01-28
Channels
- # aatree (3)
- # alda (8)
- # avi (21)
- # beginners (37)
- # boot (193)
- # cbus (1)
- # cider (29)
- # cljs-dev (8)
- # cljsjs (3)
- # cljsrn (20)
- # clojure (76)
- # clojure-dev (13)
- # clojure-miami (20)
- # clojure-portugal (2)
- # clojure-russia (220)
- # clojure-sg (2)
- # clojurebridge (5)
- # clojurescript (94)
- # community-development (14)
- # conf-proposals (110)
- # core-async (12)
- # cursive (12)
- # datascript (6)
- # datomic (14)
- # dirac (72)
- # emacs (49)
- # hoplon (86)
- # jobs (33)
- # jobs-discuss (1)
- # ldnclj (6)
- # lein-figwheel (1)
- # off-topic (56)
- # om (139)
- # onyx (29)
- # pedestal (17)
- # proton (23)
- # re-frame (45)
- # reagent (35)
- # ring-swagger (4)
- # test-check (1)
- # testing (8)
- # yada (11)
re: the ::events
(sorry late to the party)
["/events" {:get [::events (start-event-stream stream-ready)]}]
this maps GET requests the url ”/events”
to (start-event-stream)
but also names the route
you can have unnamed routes {:get (start-event-stream stream-ready)}
or named routes as above
you name them with a keyword that you can pass to route/url-for
in this case, the keyword is namespaced, hence the extra colon :
so assuming that file is in ns
(ns example.routes)
then ::events
is shorthand for :example.routes/events
this allows you to use a generic word like ‘events'
while avoiding name clashes
from a hypothetically different namespace, assume you want to redirect someone to that endpoint
you could do
`(ns example.other (:require [io.pedestal.http.route :as route] [example.routes :as r])) … (ring/redirect (route/url-for ::r/events)) `
meh forgive the formatting, hopefully the idea is clear...
hope that helps someone