Skip to content

Instantly share code, notes, and snippets.

@hrj
Created October 24, 2018 07:15
Show Gist options
  • Save hrj/d43cb021cd894543bcf0c9d0886ed06c to your computer and use it in GitHub Desktop.
Save hrj/d43cb021cd894543bcf0c9d0886ed06c to your computer and use it in GitHub Desktop.
sample jl http server
import net.freeutils.httpserver._
object LCFramework{
def main(args: scala.Array[String]) {
val port = 8888
val server = new HTTPServer(port)
val host = server.getVirtualHost(null)
host.addContext("/hello", (req, resp) => {
resp.getHeaders().add("Content-Type", "text/plain");
resp.send(200, "Hello, World!");
0
})
server.start()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment