Skip to content

Instantly share code, notes, and snippets.

@codemwnci
Created August 25, 2017 20:44
Show Gist options
  • Save codemwnci/2744cd46a92f6ac9f7e5ced66467d7ac to your computer and use it in GitHub Desktop.
Save codemwnci/2744cd46a92f6ac9f7e5ced66467d7ac to your computer and use it in GitHub Desktop.
Delete a Todo
delete(":id") { req, res ->
val rowsDeleted = using(sessionOf(HikariCP.dataSource())) { session ->
session.run(queryOf("delete from todo where id=?", req.params("id").toLong()).asUpdate)
}
if (rowsDeleted == 1) "ok"
else serverError("something went wrong")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment