Last active
May 4, 2019 20:39
-
-
Save ktutnik/457847b282a552b4377e97fb1a3a90ee to your computer and use it in GitHub Desktop.
This file contains hidden or 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
export class TodosController { | |
//POST /todo | |
save(data: Todo) { | |
return db("Todo").insert({ ...data }) | |
} | |
//GET /todo/id | |
get(id: number) { | |
return db("Todo").where({ id }).first() | |
} | |
//PUT /todo/id | |
modify(id: number, data: Todo) { | |
return db("Todo").update(data).where({ id }) | |
} | |
//DELETE /todo/id | |
delete(id: number) { | |
return db("Todo").update({ deleted: true }).where({ id }) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment