Skip to content

Instantly share code, notes, and snippets.

@codemwnci
Last active August 25, 2017 20:35
Show Gist options
  • Save codemwnci/1bb8ace456de38bb007f5193c4547206 to your computer and use it in GitHub Desktop.
Save codemwnci/1bb8ace456de38bb007f5193c4547206 to your computer and use it in GitHub Desktop.
Get all todos
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