Fork me on GitHub
#babashka
<
2023-03-19
>
hoynk12:03:07

I think I saw an example of a on-liner babashka script to serve files via http, like the infamous python -m SimpleHTTPServer but I am not finding it anymore.

borkdude12:03:10

https://github.com/babashka/http-server/ you can install it with bbin:

bbin install org.babashka/http-server --mvn/version 0.1.11

hoynk12:03:14

Hmmm... interesting. I thought no install was needed. Great work, by the way!

❤️ 2
borkdude12:03:48

There is no built-in file server in bb so you will need to use that dependency in your bb.edn or install it via bbin (#C0400TZENE7)

lispyclouds12:03:17

on that note @U04V15CAJ since we are jdk 19+, would it be worth to have something in bb based on https://blogs.oracle.com/javamagazine/post/java-18-simple-web-server

lispyclouds12:03:58

jshell> var handler = SimpleFileServer.createFileHandler(Path.of("/some/path"));
jshell> var server = HttpServer.create(new InetSocketAddress(8080), 
   ...> 10, "/somecontext/", handler); 
jshell> server.start();

🧡 2
borkdude12:03:50

I don’t think it adds value besides binary size compared to what’s there

lispyclouds12:03:07

right, i was thinking more in terms this should deprecate the need for https://github.com/babashka/http-server/ ?

lispyclouds12:03:27

but if its too much binary size, yeah not worth it

borkdude13:03:25

Worth a local experiment, go ahead

borkdude10:03:17

@U7ERLH6JX an alternative is to include the source of bb http-server (like what's been done with spec.alpha): this would only increase the binary with 10kb or so while still having the convenience of doing bb -m babashka.http-server without including additional deps

eval202016:03:47

Odd that v0.2.16 is considered the https://github.com/babashka/fs/releases on GitHub :thinking_face: What’s the logic? Anything needed in the build-step?

borkdude16:03:23

@U04V6FEES not sure what happened but I think it's fixed now