{"id":18977575,"url":"https://github.com/evgeniy-dammer/choosebook","last_synced_at":"2026-04-09T20:30:15.622Z","repository":{"id":135174711,"uuid":"481888897","full_name":"evgeniy-dammer/choosebook","owner":"evgeniy-dammer","description":"\"Choose Your Own Adventure Book\" exercise from Gophercises (by John Calhoun)","archived":false,"fork":false,"pushed_at":"2022-04-15T09:22:50.000Z","size":7,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-01T09:42:21.222Z","etag":null,"topics":["choose-your-own-adventure","chooseyourownadventure","go","golang","gophercises"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/evgeniy-dammer.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-04-15T08:20:25.000Z","updated_at":"2022-04-15T08:25:38.000Z","dependencies_parsed_at":null,"dependency_job_id":"b60034ac-7f50-44e6-83aa-03963f2b66e0","html_url":"https://github.com/evgeniy-dammer/choosebook","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/evgeniy-dammer%2Fchoosebook","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/evgeniy-dammer%2Fchoosebook/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/evgeniy-dammer%2Fchoosebook/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/evgeniy-dammer%2Fchoosebook/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/evgeniy-dammer","download_url":"https://codeload.github.com/evgeniy-dammer/choosebook/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239978048,"owners_count":19728271,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["choose-your-own-adventure","chooseyourownadventure","go","golang","gophercises"],"created_at":"2024-11-08T15:29:39.671Z","updated_at":"2026-04-09T20:30:15.560Z","avatar_url":"https://github.com/evgeniy-dammer.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# \"Choose Your Own Adventure Book\" exercise from Gophercises (by Jon Calhoun)\n\nWebsite: https://gophercises.com\n\nGitHub: https://github.com/gophercises\n\nYouTube: https://www.youtube.com/playlist?list=PLVEltXlEeWglGINo25GxVfvSSylLVg4r1\n\n## Task\n[Choose Your Own Adventure](https://en.wikipedia.org/wiki/Choose_Your_Own_Adventure) is (was?) a series of books intended for children where as you read you would occasionally be given options about how you want to proceed. For instance, you might read about a boy walking in a cave when he stumbles across a dark passage or a ladder leading to an upper level and the reader will be presented with two options like:\n\n- Turn to page 44 to go up the ladder.\n- Turn to page 87 to venture down the dark passage.\n\nThe goal of this exercise is to recreate this experience via a web application where each page will be a portion of the story, and at the end of every page the user will be given a series of options to choose from (or be told that they have reached the end of that particular story arc).\n\nStories will be provided via a JSON file with the following format:\n\n```json\n{\n  // Each story arc will have a unique key that represents\n  // the name of that particular arc.\n  \"story-arc\": {\n    \"title\": \"A title for that story arc. Think of it like a chapter title.\",\n    \"story\": [\n      \"A series of paragraphs, each represented as a string in a slice.\",\n      \"This is a new paragraph in this particular story arc.\"\n    ],\n    // Options will be empty if it is the end of that\n    // particular story arc. Otherwise it will have one or\n    // more JSON objects that represent an \"option\" that the\n    // reader has at the end of a story arc.\n    \"options\": [\n      {\n        \"text\": \"the text to render for this option. eg 'venture down the dark passage'\",\n        \"arc\": \"the name of the story arc to navigate to. This will match the story-arc key at the very root of the JSON document\"\n      }\n    ]\n  },\n  ...\n}\n```\n\nYou are welcome to design the code however you want. You can put everything in a single `main` package, or you can break the story into its own package and use that when creating your http handlers.\n\nThe only real requirements are:\n\n1. Use the `html/template` package to create your HTML pages. Part of the purpose of this exercise is to get practice using this package.\n2. Create an `http.Handler` to handle the web requests instead of a handler function.\n3. Use the `encoding/json` package to decode the JSON file. You are welcome to try out third party packages afterwards, but I recommend starting here.\n\nA few things worth noting:\n\n- Stories could be cyclical if a user chooses options that keep leading to the same place. This isn't likely to cause issues, but keep it in mind.\n- For simplicity, all stories will have a story arc named \"intro\" that is where the story starts. That is, every JSON file will have a key with the value `intro` and this is where your story should start.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fevgeniy-dammer%2Fchoosebook","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fevgeniy-dammer%2Fchoosebook","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fevgeniy-dammer%2Fchoosebook/lists"}