Last active
August 25, 2017 20:35
-
-
Save codemwnci/1bb8ace456de38bb007f5193c4547206 to your computer and use it in GitHub Desktop.
Get all todos
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
get("") { req, res -> | |
val todos: List<Todo> = using(sessionOf(HikariCP.dataSource())) { session -> | |
session.run( queryOf("select id, text, done, created_at from todo").map(toTodo).asList ) | |
} | |
jacksonObjectMapper().writeValueAsString(todos) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment