A recent blog post, Clojure like its PHP, shows that Clojure can serve requests as a cgi-bin script running through Babashka.
Wanting to try this out myself, I had to learn that the local webhost providers I checked did not allow to run executables.
But some allow running Python cgi scripts. So I went on and tried Hy, a Clojure inspired Lisp that compiles to Python’s AST.
I implemented a small backend for the Lumninus guestbook example written in Cljs/Reagent. You can find the source here. It shows, amongst other things, the communication between Cljs and Hy via Transit.
For the (naturally unspectacular) on-line version, I had to upload the code for Hy and Transit to the cgi-bin of the server (all respective modules are in the .egg zip-files of the repository). Note: The Hy repl feature is turned off in the on-line version.
I also added a backend written in Phel, a Clojure inspired Lisp that compiles to PHP (thanks @John_Shaffer for the hint).
7 posts - 3 participants