Skip to content

Instantly share code, notes, and snippets.

@umhan35
Last active March 26, 2016 03:41
Show Gist options
  • Save umhan35/1c4c09f6e050266556b3 to your computer and use it in GitHub Desktop.
Save umhan35/1c4c09f6e050266556b3 to your computer and use it in GitHub Desktop.
Simplest scala http server
import com.sun.net.httpserver._
import java.net._
val server = HttpServer.create(new InetSocketAddress(8000), 0)
server.createContext("/", new HttpHandler {
def handle(exchange: HttpExchange) {
exchange.sendResponseHeaders(200, 0)
exchange.getResponseBody.write("hello".getBytes)
exchange.getResponseBody.close()
}
})
server.start
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment