Skip to content

Instantly share code, notes, and snippets.

@hhariri
Created August 30, 2013 09:45
Show Gist options
  • Save hhariri/6388181 to your computer and use it in GitHub Desktop.
Save hhariri/6388181 to your computer and use it in GitHub Desktop.
data class Customer(val id: Int, val name: String, val email: String, val country: String)
val customerList = arrayListOf<Customer>(
Customer(1, "Joe Smith", "[email protected]", "UK"),
Customer(2, "Jack Jones", "[email protected]", "US"),
Customer(3, "Maria Gonzalez", "[email protected]", "Spain")
)
fun main(args: Array<String>) {
val appServer = AppServer()
appServer.negotiateContent()
appServer.get("/customer", listCustomers) // this can be inline or implemented somewhere else, as in this case
appServer.start()
}
val listCustomers = handler {
response.send(customerList)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment