This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-09-29
Channels
- # beginners (10)
- # cider (10)
- # cljs-dev (17)
- # clojure (14)
- # clojure-losangeles (1)
- # clojure-spec (1)
- # clojure-uk (3)
- # clojurescript (49)
- # core-async (5)
- # css (1)
- # datomic (2)
- # duct (26)
- # emacs (13)
- # figwheel (6)
- # figwheel-main (5)
- # garden (1)
- # keechma (6)
- # nrepl (1)
- # off-topic (6)
- # re-frame (52)
- # shadow-cljs (132)
- # spacemacs (4)
- # tools-deps (26)
@weavejester why we need :prep-tasks ["javac" "compile" ["run" ":duct/compiler"]]
??? I don't see any definition for :duct/compiler
It's for cases when you have a compiler key, and you want to run it before building. For example, if you have a ClojureScript project, you'd want to compile that ClojureScript into Javascript resources before packaging it up.
If you're not using compilers, and not using any modules that use compilers, the :prep-tasks
addition can be removed.
Ductifying https://github.com/ptaoussanis/sente means 1. adding some routes and 2. including the correct adapter depending on which web server is being used
I haven't had any experience with Sente before. If it's just adding some routes that sounds straightforward. If it requires a custom adapter as well you'll need to write an init-key
and halt-key
method around that.
It looks like it supports http-kit, so you can use the Duct library for that.
Should the adding of the routes be part of the duct model?
and should duct prep select the adapter to include for me based on its knowledge of which web server i'm using?
By "Duct model" are you writing a module for this, or is it just a single-use thing?
In theory, this ought to be a module i think?
In which case you could add in the server (if one doesn't exist already), and the routes, and whatever else is needed.
it's not a complex library to use but to my eyes it seems to present some new relationships I haven't seen in duct modules before
If it's possible to add the routes through middleware that might be easiest.
Or most compatible, since then you don't need to worry about inserting the routes directly into the configuration.
Duct middleware?
Ring middleware. It would be a key that initializes into a Ring middleware function.
Ah okay. That's clear enough.
You probably want to take a look at the duct/module.web library. Do something similar, just simpler.
So add in the http-kit server if it's not there already. Maybe add a new keyword relationship.
Like derive :duct.server.http/http-kit
from :duct.server.http/sente-compatible
or something like that.
So introduce sente as a parent of the web server?
Right. Then you just have the module look for a key that inherits from sente-compatible. If none exist, try to add one. You could also add error handling for the case where there's a web server that isn't sente-compatible.
Actually i think i see what you're getting at.
I'll go fiddle with it and see what I can come up with. thanks for the pointers.
No problem. Let me know what you come up with.
I'm uncertain how to model those relationships in duct terms
Actually i think i see what you're getting at.