- Hands-On Server-Side Web Development with Swift
- Angus Yeung
- 46字
- 2021-06-10 19:00:25
Retrieving all entries
Append the getTotal() function to the line right after boot(router:):
func getTotal(_ req: Request) -> String {
let total = journal.total()
print("Total Records: \(total)")
return "\(total)"
}
The function simply calls the JournalController total() function and return the total count of entries.