3/// Controls basic CRUD operations on `Todo`s.
4final class TodoController {
5 /// Returns a list of all `Todo`s.
6 func index(_ req: Request) throws -> Future<[Todo]> {
7 return Todo.query(on: req).all()
10 /// Saves a decoded `Todo` to the database.
11 func create(_ req: Request) throws -> Future<Todo> {
12 return try req.content.decode(Todo.self).flatMap { todo in
13 return todo.save(on: req)
17 /// Deletes a parameterized `Todo`.
18 func delete(_ req: Request) throws -> Future<HTTPStatus> {
19 return try req.parameters.next(Todo.self).flatMap { todo in
20 return todo.delete(on: req)
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list