This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-11-10
Channels
- # aws (45)
- # bangalore-clj (16)
- # beginners (109)
- # boot (137)
- # cider (7)
- # cljs-dev (54)
- # cljsrn (22)
- # clojure (77)
- # clojure-conj (1)
- # clojure-greece (2)
- # clojure-nl (5)
- # clojure-russia (36)
- # clojure-spec (15)
- # clojure-uk (54)
- # clojurescript (118)
- # cursive (7)
- # datomic (25)
- # emacs (33)
- # hoplon (276)
- # klipse (38)
- # lein-figwheel (1)
- # leiningen (9)
- # melbourne (1)
- # off-topic (18)
- # om (98)
- # onyx (6)
- # pedestal (1)
- # perun (24)
- # re-frame (46)
- # reagent (6)
- # ring-swagger (3)
- # spacemacs (67)
- # specter (15)
- # untangled (33)
- # vim (6)
Developing CLJS lambda functions using cljs-lambda and associated projects is very nice.
I've always thought it would be nice to use one of the data-based routing libraries and retargeting it to API gateway
so that you had a good story for local development as well as being able to skip shed color choices for the api (IMO the least interesting piece)
I just mean, to declare what you want your api to look like using the same syntax/data as some routing library, and then let the library build out the templates for you
Any preference for routing library? I’m not familiar with them, and I might add something like that to cljs-lambda depending on how difficult it turns out to be
I don't have a particular preference, but one of the ones that is data-based instead of macro-based is probably a good start
So with my existing API, it’s for a webhook that only sends POST params. I need to create a template that maps that to a JSON doc, since lambda receives JSON.
one thing I could imagine would be doing something like this (using compojure-api syntax):
(GET "/add" request
:query-params [num :- s/Int]
(ok (inc num)))
theoretically, you could even use compojure-api (or ring-swagger, which is what it uses under the hood) to generate the swagger spec for that route for you
with the upside of, if you did it "right", you might be able to use compojure-api locally for development testing
(compojure-api is just a convenient example here since it already generates a swagger json/yaml spec for you)
there would obviously be a couple limitations (i.e. your whole routes have to defined at compile time)
Doesn’t look like it: “all compojure-api route functions & macros return compojure.api.routes/Route-records”...
Ideally I’d be able to define the templates somewhere static so that the cljs-lambda lein plugin could build things based on the definition.
couldn't the cljs-lambda lein plugin just invoke whatever compojure.api.routes/get-routes
and use the resulting info?
I don't know if their wrap-routes stuff can be replaced or includes the right meta to lookup source code so that you could compile the bodies to lambdas
And it would be a large change to the way things work right now AFAIK, but I’m not that familiar with it yet.
i.e. something like this:
["/" {"blog" {:get
{"/index" (lambda-fn :my-index)}}
{:request-method :post :server-name ""}
{"/zip" (lambda-fn :zip)}}]
that was just adapted from an example at https://github.com/juxt/bidi
it does look like if you can find something with output to swagger 2.0, you can directly import that into API Gateway: http://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-import-api.html