And the video is up as well now: https://youtu.be/pgNp4Lk3gf0
you beat me by 1 millis on posting the video... Babashka is soo fast! 🙂
Should I expect this to return something useful?
$ bb
user=> (doc io/reader)
nil
(doc map)
works fine
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
Although in this case I would have expected it to work
@jumar 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)
-------------------------
<http://clojure.java.io/reader|clojure.java.io/reader>
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?
@admin055 The pod implementation reference is here: https://github.com/babashka/babashka.pods And here is a list of examples: https://github.com/borkdude/babashka/blob/master/doc/projects.md#pods
Perfect, thx for links and your disponibility. And for Graalvm docker tool chain image, you confirm?
I usually download GraalVM to a local dir and set GRAALVM_HOME
@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
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.
@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.
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 🙂
awesome :) this is a small demo of echo-ing the request: ~
~
ah nice, thats great! thanks again
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 "<http://localhost:3000>") 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}
@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.
built-in hiccup would be cool. I think bootleg can be used as a pod for this in the meantime, yes?
true! a nice example of that is Gaiwan's site: https://github.com/lambdaisland/gaiwan_co#tech-stack
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
https://github.com/enforser/enforser/blob/master/src/blog/core.clj
I see you also have a bit of Rust in there. Are you using Rust much?
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
I have this thing you can use with babashka. It's written in Rust: https://github.com/babashka/pod-babashka-filewatcher
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