3 ms·
I was learning Clojure and OCaml last week (again) after doing a survey of a handful of functional languages. I still haven't seen a good way to spin up a reall
by devmunchies 8y ago
I was learning Clojure and OCaml last week (again) after doing a survey of a handful of functional languages. I still haven't seen a good way to spin up a really simple HTTP server like Sinatra or Express. Ones I did see either had a huge bug, were more verbose, or had no "getting started" documentation. The languages themselves are fun though.
- tpfour 8y agoYou should try Gerbil, a dialect built on Gambit Scheme. You can find it at https://github.com/vyzo/gerbil https://github.com/vyzo/gerbil. I suggest you look into https://github.com/vyzo/gerbil/blob/master/doc/tutorial/httpd.md https://github.com/vyzo/gerbil/blob/master/doc/tutorial/http... for a simple HTTP server :)
- ng12 8y agoAnd that's the problem. By picking these languages you're committing to building a lot of stuff yourself. Sure, I'd rather be writing anything other than JavaScript but you can't deny the Node ecosystem has solved a lot of problems.
- cultus 8y agoIt's not really a problem for Clojure since it is on the JVM, so you get all of those libraries for free. Java interop is very easy, especially due to macros. I've never used Clojurescript. I'm not sure how easy that is with Node.
- lilactown 8y agoOCaml is rough, but Clojure has quite a few nice libraries for getting up and running with a simple HTTP server - Ring is fairly simple and there are libraries and frameworks that build on top of it. Was there something in particular you found missing or struggled with?
- Plugawy 8y agoCompojure - https://github.com/weavejester/compojure#usage https://github.com/weavejester/compojure#usage is a very close equivalent of Sinatra. Ring (which most, if not all web libraries build on top of) is directly inspired by Ruby's Rack (I think Python and Node have a very similar, middleware oriented design).