Skip to content

Instantly share code, notes, and snippets.

@rpiotrow
Created August 26, 2019 07:17
Show Gist options
  • Save rpiotrow/af0215676f0ffe30085963b38ff59aaa to your computer and use it in GitHub Desktop.
Save rpiotrow/af0215676f0ffe30085963b38ff59aaa to your computer and use it in GitHub Desktop.
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