Created
July 6, 2016 14:33
-
-
Save monkey-mas/eeade1dc021ab9f96a1dfa5f6198e09d to your computer and use it in GitHub Desktop.
SampleFinagleServer
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 com.twitter.finagle.{Http, Service} | |
import com.twitter.finagle.http | |
import com.twitter.util.{Await, Future} | |
object Server extends App { | |
val service = new Service[http.Request, http.Response] { | |
def apply(req: http.Request): Future[http.Response] = { | |
val res = http.Response(req.version, http.Status.NoContent) | |
res.contentString = "hello world" | |
Future.value(res) | |
} | |
} | |
val server = Http.server.withLabel("server") | |
.withCompressionLevel(6) | |
.serve(":8080", service) | |
Await.ready(server) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment