Skip to content

Instantly share code, notes, and snippets.

@lankydan
Created August 12, 2019 09:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lankydan/58503f1a8be2d0548e2f3afc6c6f7ae0 to your computer and use it in GitHub Desktop.
Save lankydan/58503f1a8be2d0548e2f3afc6c6f7ae0 to your computer and use it in GitHub Desktop.
Corda + Ktor - server
fun main() {
embeddedServer(
Netty,
port = System.getProperty("server.port").toInt(),
module = Application::module
).start().addShutdownHook()
}
fun Application.module() {
val connection: CordaRPCConnection = connectToNode()
install(CallLogging) { level = Level.INFO }
install(ContentNegotiation) { cordaJackson(connection.proxy) }
routing { messages(connection.proxy) }
addShutdownEvent(connection)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment