Skip to content

Instantly share code, notes, and snippets.

@vkostyukov
Created November 11, 2015 13:30
Show Gist options
  • Save vkostyukov/861abc1d6f86272cf5be to your computer and use it in GitHub Desktop.
Save vkostyukov/861abc1d6f86272cf5be to your computer and use it in GitHub Desktop.
HelloWorld
import com.twitter.finagle.Http
import com.twitter.util.{Future, Await}
import io.finch._
object Test1 extends App {
implicit val encodeMap: EncodeResponse[Map[String, String]] =
EncodeResponse("text/plain")(map =>
Buf.Utf8(map.toSeq.map(kv => kv._1 + ":" + kv._2).mkString("\n"))
)
val service = get("hello") { Ok("Hello") }
Await.ready(Http.server.serve(":8080", service.toService))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment