Created
October 24, 2018 07:15
-
-
Save hrj/d43cb021cd894543bcf0c9d0886ed06c to your computer and use it in GitHub Desktop.
sample jl http server
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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