May 2019
Beginner to intermediate
466 pages
10h 44m
English
Keep in mind that a back navigation URL looks like /c701b1b0b1/back/1, where the first part is the session ID and the last part is the index of the item in the history stack. To implement it, the workflow is similar to articlepage—we parse the Request URI, retrieve the game by session ID, and get the article from the game's history stack. Since we go back in the game's history, everything beyond the current article index is to be removed from the navigation stack. When done, we respond by rendering the corresponding Wikipedia article. The code is short and readable:
const backpage = HTTP.HandlerFunction() do req uri_parts = parseuri(req.target) game = gamesession(uri_parts[1]) history_index = parse(UInt8, ...
Read now
Unlock full access