Created
August 26, 2019 07:17
-
-
Save rpiotrow/af0215676f0ffe30085963b38ff59aaa 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
fun main(args: Array<String>) { | |
val server = embeddedServer(Netty, port = 8080) { | |
configureJsonSerialization() | |
install(Routing) { | |
get("/employees") { | |
call.respond(listOf(Employee(1, "John", "Smith"))) | |
} | |
} | |
} | |
server.start(wait = true) | |
} | |
private fun Application.configureJsonSerialization() { | |
install(ContentNegotiation) { | |
jackson { | |
enable(SerializationFeature.INDENT_OUTPUT) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment