Created
August 25, 2017 20:44
-
-
Save codemwnci/2744cd46a92f6ac9f7e5ced66467d7ac to your computer and use it in GitHub Desktop.
Delete a Todo
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
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