An open API service indexing awesome lists of open source software.

https://github.com/cjsidler/go-cyoa

Choose Your Own Adventure - Follow the story of the Little Blue Gopher with this Golang Web Application.
https://github.com/cjsidler/go-cyoa

choose-your-own-adventure game go golang webapp

Last synced: 4 months ago
JSON representation

Choose Your Own Adventure - Follow the story of the Little Blue Gopher with this Golang Web Application.

Awesome Lists containing this project

README

          




Golang Create Your Own Adventure


Follow the story of the Little Blue Gopher with this Golang Web Application.


![](./demo-image.png)

Table of Contents



  1. About The Project



  2. Getting Started


  3. License

  4. Contact

  5. Acknowledgments

## About The Project

The Golang Create Your Own Adventure web application reads in a story provided by a JSON file in the following format:

```json
{
"story-arc": {
"title": "A title for that story arc. Think of it like a chapter title.",
"story": [
"A series of paragraphs, each represented as a string in a slice.",
"This is a new paragraph in this particular story arc."
],
"options": [
{
"text": "the text to render for this option. eg 'venture down the dark passage'",
"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"
}
]
}
}
```

Each story arc will have a unique key that represents the name of that particular arc, and each adventure will have a story arc with the key "intro" that represents the first story arc of the adventure. Options will be empty if it is the end of that particular story arc. Otherwise, options will have one or more JSON objects that represent an "option" that the reader has at the end of a story arc.

The story is made available to the user using Go templates and http routes. If a user visits the root route (i.e., http://localhost:8080/), the user will be shown the intro story arc.

The story JSON file defaults to "adventure.json", but the user can choose a different file by using the "-filename" flag followed by the name of the JSON file.

(back to top)

### Built With

[![Go][go-shield]][go-url]
![HTML][html-shield]
![CSS][css-shield]

(back to top)

## Getting Started

### Prerequisites

- Golang:
[https://go.dev/doc/install](https://go.dev/doc/install)

### Installation

1. Clone the repo
```sh
git clone https://github.com/cjsidler/go-cyoa.git
```
2. Build an executable
```sh
go build -o "go-cyoa.exe" main.go
```
3. Run the executable.
```sh
.\go-cyoa.exe -filename "mystory.json"
```

(back to top)

## License

[![MIT License][license-shield]][license-url]

(back to top)

## Contact

Contact me via email, LinkedIn, or GitHub:

[![Email][gmail-shield]][gmail-url]
[![LinkedIn][linkedin-shield]][linkedin-url]
[![GitHub][github-shield]][github-url]

(back to top)

## Acknowledgments

- [Gophercises](https://gophercises.com/)
- [README Template](https://github.com/othneildrew/Best-README-Template)
- [Link Badges](https://shields.io/)

(back to top)

[license-shield]: https://img.shields.io/github/license/othneildrew/Best-README-Template.svg?style=for-the-badge
[license-url]: https://github.com/othneildrew/Best-README-Template/blob/master/LICENSE.txt
[linkedin-shield]: https://img.shields.io/badge/-LinkedIn-black.svg?style=for-the-badge&logo=linkedin&colorB=555
[linkedin-url]: https://www.linkedin.com/in/collinsidler/
[go-shield]: https://img.shields.io/badge/Golang-blue?style=for-the-badge&logo=go&logoColor=white
[html-shield]: https://img.shields.io/badge/Html-orange?style=for-the-badge&logo=html5&logoColor=white
[css-shield]: https://img.shields.io/badge/Css-cornflowerblue?style=for-the-badge&logo=css3
[go-url]: https://go.dev
[gmail-shield]: https://img.shields.io/badge/Gmail-D14836?style=for-the-badge&logo=gmail&logoColor=white
[gmail-url]: mailto:cjsidler@gmail.com
[github-shield]: https://img.shields.io/badge/GitHub-black?style=for-the-badge&logo=github&logoColor=white
[github-url]: https://github.com/cjsidler/go-cli-quizzer