Fork me on GitHub
#duct
<
2018-09-29
>
mariusz_jachimowicz15:09:01

@weavejester why we need :prep-tasks ["javac" "compile" ["run" ":duct/compiler"]] ??? I don't see any definition for :duct/compiler

weavejester15:09:11

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.

weavejester15:09:52

If you're not using compilers, and not using any modules that use compilers, the :prep-tasks addition can be removed.

colliderwriter18:09:23

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

weavejester18:09:21

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.

weavejester18:09:04

It looks like it supports http-kit, so you can use the Duct library for that.

colliderwriter19:09:26

Should the adding of the routes be part of the duct model?

colliderwriter19:09:18

and should duct prep select the adapter to include for me based on its knowledge of which web server i'm using?

weavejester19:09:54

By "Duct model" are you writing a module for this, or is it just a single-use thing?

colliderwriter19:09:55

In theory, this ought to be a module i think?

weavejester19:09:50

In which case you could add in the server (if one doesn't exist already), and the routes, and whatever else is needed.

colliderwriter19:09:05

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

weavejester19:09:16

If it's possible to add the routes through middleware that might be easiest.

weavejester19:09:42

Or most compatible, since then you don't need to worry about inserting the routes directly into the configuration.

colliderwriter19:09:58

Duct middleware?

weavejester19:09:37

Ring middleware. It would be a key that initializes into a Ring middleware function.

colliderwriter19:09:06

Ah okay. That's clear enough.

weavejester19:09:39

You probably want to take a look at the duct/module.web library. Do something similar, just simpler.

weavejester19:09:04

So add in the http-kit server if it's not there already. Maybe add a new keyword relationship.

weavejester19:09:54

Like derive :duct.server.http/http-kit from :duct.server.http/sente-compatible or something like that.

colliderwriter19:09:55

So introduce sente as a parent of the web server?

weavejester19:09:56

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.

colliderwriter19:09:12

Actually i think i see what you're getting at.

colliderwriter19:09:02

I'll go fiddle with it and see what I can come up with. thanks for the pointers.

weavejester19:09:15

No problem. Let me know what you come up with.

colliderwriter18:09:23

I'm uncertain how to model those relationships in duct terms