In Kitura-Session 3.3, by defining the type we expect from the session, we get our Codable model straight out of the session:
router.get("/session") { request, response, nextinletbooks: [Book] = request.session?["books"] ?? []response.send(books)next()}Even with a simple model, this has vastly reduced the amount of code required, added compile time safety and made our code easier to read!
Source: Kitura-Session 3.3: Sharing Codable objects between a user’s requests