Fork me on GitHub

What's the right way to call bb code from bb tasks? I'm resorting now to (shell "bb bbscript.clj")


@dennisa you can use (load-file "bbscript.clj")


or if you have the file on the classpath using :paths, then :requires ([thescriptdir.thescriptns])

👍 2

the latter assumes no side effects on the top level

michael zhou15:08:18

Hey @borkdude does bb support crux now?


What makes you think it does?

michael zhou16:08:57

I do not know. Hope bb will support. Crux is a great document and graph database


There could be a crux pod working against the JSON api for sure 😉

💡 2

why not just use an http client in bb directly then?


or are you not talking about a JSON rest API?


right, yeah probably an HTTP client is a better idea there

michael zhou00:08:16

Thank you very much! @borkdude @U0C8489U6 will try client.

Cora (she/her)23:08:24

is babashka going to get a routing library like compojure?

Cora (she/her)23:08:37

it's very cool that it supports an http server, just surprising that there's no routing layer (or maybe none easily port?)


Some reasons are: 1) Choice paralysis: compojure, reitit? 2) These routing libs aren't really small, e.g. compojure comes with deps like instaparse 3) HTTP apps aren't really the major use case for bb, perhaps. So far just a str/split in "/" and core.match could be sufficient for most of them.


Here is an example of core.match being used to dispatch on routes. Seems quite elegant and sufficient for many cases: Was posted in #announcements by @UFBL6R4P3 :

👍 4
clojure-spin 2
🙌 2

I agree. People may not be used to this, but I think it's sufficient for the basic web app you will write with bb.

👍 4