Created
September 23, 2018 03:51
-
-
Save xerial/7fca52d09c62ffbd53952a12accfda1a to your computer and use it in GitHub Desktop.
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 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