September 2023
Intermediate to advanced
470 pages
11h 12m
English
We can now put these four functions into our Zettai class and implement them there.
But first, we need to have some lists to show. For the moment, let’s take the simplest possible approach and put them in an immutable map, injected in the constructor of Zettai, which contains the lists of each user of our system:
| ① | data class Zettai(val lists: Map<User, List<ToDoList>>): HttpHandler{ |
| | |
| | //routes functions are not changed... |
| | |
| ② | private fun showList(request: Request): Response = |
| | request.let(::extractListData) |
| | .let(::fetchListContent) |
| | .let(::renderHtml) |
| | .let(::createResponse) |
| | |
| | |
| ③ | fun extractListData(request: Request): Pair<User, ListName> { |
| | val user = request.path("user").orEmpty() ... |
Read now
Unlock full access