Skip to content

Instantly share code, notes, and snippets.

@monkey-mas
Created July 6, 2016 14:33
Show Gist options
  • Save monkey-mas/eeade1dc021ab9f96a1dfa5f6198e09d to your computer and use it in GitHub Desktop.
Save monkey-mas/eeade1dc021ab9f96a1dfa5f6198e09d to your computer and use it in GitHub Desktop.
SampleFinagleServer
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