This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-07-23
Channels
- # announcements (1)
- # aws (13)
- # babashka (31)
- # beginners (102)
- # calva (46)
- # cider (16)
- # clj-kondo (1)
- # cljs-dev (3)
- # clojars (1)
- # clojure (396)
- # clojure-argentina (1)
- # clojure-australia (4)
- # clojure-europe (64)
- # clojure-nl (2)
- # clojure-uk (8)
- # clojurescript (20)
- # conjure (5)
- # cursive (4)
- # datomic (15)
- # emacs (48)
- # graalvm (69)
- # graalvm-mobile (1)
- # jobs (4)
- # jobs-rus (1)
- # lsp (6)
- # malli (15)
- # meander (2)
- # observability (11)
- # off-topic (10)
- # pathom (2)
- # portal (4)
- # re-frame (19)
- # reitit (1)
- # remote-jobs (3)
- # sci (1)
- # shadow-cljs (51)
- # tools-deps (11)
- # vim (12)
- # xtdb (13)
If i send some paramtrrs into a rest API with a GET request using reg-event-fx with reframe, and i wqnt the backend to access the data through a compojure set up, is it enough to do the following? `(defroutes app (GET “/“ [a b] (response (+ a b)))` Assuming that a and b are data that are sent into the restAPI and that everything todo with ring middleware and json wrapping is taken care of? I guess this is more of a compojure question but idk where to post it.
Take like 10 steps back. Your get handler there needs to handle the request in some way. When you say (GET "/" [a b] ...) where does it take the info from in the request to get a and b
once you can call your api with curl, then you can shift to figuring out how to construct a request from the frontend
I guess i wasnt being precise enough, i am wondering more about how to access the json data with compojure. If i know it has a format {”a”: 1}, how do you access that data with destructuring?
Is it as easy as using a vector?
Ok thank you!
@U027C7611DF with compojure you'll usually be working with the request object on the route. So it's not that much different from what @U3JH98J4R mentioned but just slightly where you'd have to get some values out of the body of the request structure in order to see the map you passed into the API
Also i assume that frontend uses the same route