Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
import com.twitter.finagle.Http
import com.twitter.finagle.param.Stats
import com.twitter.finagle.stats.Counter
import com.twitter.server.TwitterServer
import com.twitter.util.Await
import io.finch._
import io.finch.circe._
import io.circe.generic.auto._
object Main extends TwitterServer {
case class Time(language: String, country: String)
val todos: Counter = statsReceiver.counter("times")
val postTodo: Endpoint[Time] = post("time" :: body.as[Time]) { t: Time =>
todos.incr()
Ok(t)
}
def main() {
val server = Http.server
.configured(Stats(statsReceiver))
.serve(":8888", postTodo.toService)
onExit {
server.close()
}
Await.ready(adminHttpServer)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.