Posts

Showing posts from December, 2016

Simple HTTP/HTTPS server on Scala/Akka

Let me present a simple Scala script to serve local files over HTTP or HTTPS. I've used Scala/Akka to get the good performance and to play around with the programming language I really like.

Toolchain
We need Scala, SBT (Scala interactive build tool), Conscript (a distribution mechanism for Scala apps) and Scalas (the script runner for Scala). Conscript is needed only to install Scalas here, so you may want to install the runner manually (see the Scalas link above) if you don't want to install Conscript.

For Mac OS X we're going to use Homebrew to install Scala and SBT:

 $ brew install scala sbt

Next step is Conscript (please follow the installation instructions on the official site):

 $ wget https://dl.bintray.com/foundweekends/maven-releases/org/foundweekends/conscript/conscript_2.11/0.5.1/conscript_2.11-0.5.1-proguard.jar
 $ java -jar conscript_2.11-0.5.1-proguard.jar

Next step is installing Scalas (please follow the installation instructions on the official site):

 $ cs sb…