Fork me on GitHub
#babashka
<
2020-12-02
>
borkdude09:12:07

And the video is up as well now: https://youtu.be/pgNp4Lk3gf0

👍 27
bruno.bonacci09:12:49

you beat me by 1 millis on posting the video... Babashka is soo fast! 🙂

👍 3
😄 9
jumar16:12:02

Should I expect this to return something useful?

$ bb

user=> (doc io/reader)
nil

jumar16:12:14

(doc map) works fine

borkdude16:12:25

you can report vars for which the docstring does not work, this needs fixing. sometimes the issue is that we didn't copy in the docstring of the corresponding clojure var

borkdude16:12:45

Although in this case I would have expected it to work

borkdude16:12:07

@U06BE1L6T I think you are on an old version:

$ bb
Babashka v0.2.4 REPL.
Use :repl/quit or :repl/exit to quit the REPL.
Clojure rocks, Bash reaches.

user=> (doc io/reader)
-------------------------

jumar06:12:22

Thanks, updated from v0.2.2 to v0.2.4 and it works now

Michaël Salihi16:12:52

Is there "how to" documentation somewhere to build Babashka pods? I guess Docker it's best choice at first to avoir to install all Graalvm toolchain on local computer, am I right?

Michaël Salihi17:12:21

Perfect, thx for links and your disponibility. And for Graalvm docker tool chain image, you confirm?

tvaughan23:12:54

I then use this in a project to build its native image. For example, https://gitlab.com/tvaughan/kibit-runner/-/blob/master/native-image.mk

Michaël Salihi06:12:08

Thanks @U0P7ZBZCK I'll check your links. 👍

borkdude17:12:03

I usually download GraalVM to a local dir and set GRAALVM_HOME

👍 3
borkdude17:12:37

@admin055 also see: https://github.com/lread/clj-graal-docs Note that you don't need to compile with GraalVM in order to test a pod. You can develop with the normal JVM

enforser19:12:54

I’m interested in making a simple web server which accepts POST/GET requests similar to this node script: https://www.tutorialsteacher.com/nodejs/create-nodejs-web-server Is there any ring or compojure support being added to babashka? Most clojure examples I’ve seen use those.

borkdude19:12:15

@trailcapital babashka currently comes with the http-kit server. but there is no routing library included. for the small sized web-apps people typically make with bb it's probably sufficient to look at the :method and :uri of the incoming request and act accordingly. You can see an image viewer web-app in the example folder of the babashka repo which demonstrates this.

enforser19:12:09

ah awesome, I was looking through at http_server.clj in examples but this one looks much more straightforward. Thanks! Really been enjoying bb by the way - I work at a scala shop but use babashka for all of my own scripting 🙂

borkdude19:12:08

awesome :) this is a small demo of echo-ing the request: ~

👍 3
enforser20:12:57

ah nice, thats great! thanks again

borkdude20:12:35

This one is nicer and simpler, to inspect the request:

$ bb -e '(org.httpkit.server/run-server (fn [req] (clojure.pprint/pprint req) {:body "hello"}) {:port 3000}) (curl/post "") nil'
{:remote-addr "0:0:0:0:0:0:0:1",
 :headers
 {"accept" "*/*",
  "accept-encoding" "deflate, gzip",
  "host" "localhost:3000",
  "user-agent" "curl/7.54.0"},
 :async-channel
 #object[org.httpkit.server.AsyncChannel 0x2630dd1e "/0:0:0:0:0:0:0:1:3000<->/0:0:0:0:0:0:0:1:52341"],
 :server-port 3000,
 :content-length 0,
 :websocket? false,
 :content-type nil,
 :character-encoding "utf8",
 :uri "/",
 :server-name "localhost",
 :query-string nil,
 :body nil,
 :scheme :http,
 :request-method :post}

💯 3
borkdude20:12:20

@trailcapital Here is a small function that you could use to generate some HTML (if you wish to): https://github.com/borkdude/babashka/blob/9661d8e3372e766046f22a6587050537b8b6a16f/examples/notes.clj#L21 There will probably be a babashka.hiccup or .html namespace in the future, but not there yet.

nate20:12:16

built-in hiccup would be cool. I think bootleg can be used as a pod for this in the meantime, yes?

borkdude20:12:42

true! a nice example of that is Gaiwan's site: https://github.com/lambdaisland/gaiwan_co#tech-stack

enforser20:12:52

I’m doing something similar on my personal site - use clojure to dump a bunch of static files into a directory then serve them from gh-pages. Over the holidays I may have time to try and port the hiccup portions to babashka and switch over to that as my html/static file build tool https://matthewfors.com/decrypt-zcash.html

borkdude21:12:01

I see you also have a bit of Rust in there. Are you using Rust much?

enforser21:12:58

Not really, but I’d like to dig into it more. Only using it for that post since the library to perform some required cryptography is only available in rust + to play around with WASM

borkdude21:12:18

I have this thing you can use with babashka. It's written in Rust: https://github.com/babashka/pod-babashka-filewatcher