-
-
Save crmaxx/d72ae5e80407fb64e8b4 to your computer and use it in GitHub Desktop.
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 io.undertow.Undertow | |
import io.undertow.server.HttpHandler | |
import io.undertow.server.HttpServerExchange | |
import io.undertow.util.Headers | |
object server extends App { | |
val server: Undertow = Undertow.builder().addHttpListener(8080, "localhost").setHandler(new HttpHandler() { | |
override def handleRequest(exchange: HttpServerExchange): Unit = { | |
exchange.getResponseHeaders().put(Headers.CONTENT_TYPE, "text/plain") | |
exchange.getResponseSender().send("Hello, world!") | |
} | |
}).build() | |
server.start() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment