Completing the features

Following the similar steps in the previous example, you can complete the template rendering for all other CRUD routes:

  1. The updated JournalRoutes is shown in the following:
import Vaporimport Leafstruct JournalRoutes : RouteCollection {        let journal = JournalController()    let mainPage = "/journal/all"        let title = "My Journal"    let author = "Angus"        struct JournalContext : Encodable {        let title: String        let author: String        let count: String        let entries: [Entry]    }        struct EntryContext : Encodable {        let title: String        let author: String        let index: Int        let entry: Entry    }        func boot(router: Router) throws {                let topRouter = router.grouped("journal")        topRouter.get("", use: getAll)        topRouter.get("all", use: getAll) topRouter.get("create", ...

Get Hands-On Server-Side Web Development with Swift now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.