Skip to content

Instantly share code, notes, and snippets.

@xerial
Created September 23, 2018 03:51
Show Gist options
  • Save xerial/7fca52d09c62ffbd53952a12accfda1a to your computer and use it in GitHub Desktop.
Save xerial/7fca52d09c62ffbd53952a12accfda1a to your computer and use it in GitHub Desktop.
import wvlet.airframe.http.finagle._
import com.twitter.finagle.http.Request
// Define API routes. This will read all @Endpoint annotations in MyApi
val router = Router.of[MyApi]
val design =
finagleDefaultDesign
.bind[MyApi].toSingleton // Register API impl
.bind[Router].toInstance(router) // Register http routes
.bind[FinagleServerConfig].toInstance(FinagleServerConfig(port = 8080))
design.build[FinagleServer] { server =>
// Finagle http server will start here
server.waitServerTermination
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment