Fork me on GitHub
#nbb
<
2022-07-31
>
lilactown16:07:18

putting my next question in the relevant channel: this doesn't seem to work for nbb? https://clojurians.slack.com/archives/CLX41ASCS/p1659286512703779

lilactown16:07:12

oh wait, this might be due to the way that downloading and unzipping deps doesn't work with git deps facepalm

borkdude17:07:59

I don't think that spec fork work with nbb, at least I haven't tested it

borkdude17:07:05

but we could maybe make it so

borkdude17:07:53

but I also want to include spec into bb/nbb anyways, so having a dedicated config for it in sci.configs would be good too

lilactown17:07:29

that could also be true. I still believe that git deps aren't working right

lilactown17:07:57

nvm, it does

jaide19:07:06

Exploring setting up ring-like handlers with express and using file based routing similar to remix. In simple cases, what I have works but I think if I ran into a situation where the intended route was something like api/some/data.json the ns might be incompatible as myproject.backend.routes.api.some.data\..json is probably not valid. Maybe it can be setup to load the file via filepath vs classpath then introspect the exposed api functions?

jaide19:07:22

My route handling code

👍 1
jaide19:07:18

the tl;dr impl now is that it uses like scandir api to read the files in the routes directory, loads them dynamically, then transforms the filepath into a class name to get the exposed handler type functions

👍 1
jaide19:07:05

But if the intended route contains a literal ., I'm not sure there's a way to get that into a classpath without it causing problems

jaide19:07:15

Hmm maybe the answer is simple: Where there's literal chars that are incompatible with a classpath the file\classpath could be myproject.backend.routes.api.some.data$dot$json. Might have to study up on valid classpath chars to pick a better option, but something like that would solve the problem, though it's not very intuitive

borkdude19:07:37

I wouldn't use $ on file paths since $ has special meaning in CLJS in :require

jaide19:07:59

Oh right, that makes sense

borkdude19:07:34

Clojure has munge :

(munge 'data->json)
data__GT_json
Perhaps something similar but .: __DOT__?

jaide19:07:14

Yeah exactly! I didn't know about munge though, that's really helpful