Similar to the old Goosebumps books, Bandersguru, or any other choose your own adventure game, this project was meant to emulate that. Basically with 2 terminals and curling, one could play out the story that is written inside the data/scenarios.json file included. The logic and game is finished but the story could be expanded upon. This app uses Javascript, NodeJS, and ExpressJS. It mainly handles GET and POST requests via specific routes. There can be more visual and output improvements and I will get to it when I have the time.
This is a screenshot of what playing the game looks like in one of the terminals.

This is a screenshot of the other terminal that prompts and tells the user how to play.

- git clone this repo, cd into it
- npm install
- node server.js (You will get a line of code that you can paste to get started)
- open another terminal and follow the directions after each curl
Documentation is in server.js file as well as in the terminal as you go along.
The goal of this was to learn how to use ExpressJS.
-
GET/scenarioswhere you get which scenarios are supported. Currently only one, BandersGuru. -
POST/gamewhich allows a user to start a game, given a scenario name as JSON, and returns the ID of a game, which game, and the current progress. -
GET/game/:idwhich allows a user to get a game info by ID. -
POST/game/:idwhich allows the user to choose one of the possible answer to a question and returns the following result, given the index of the selected answer. ChoiceIndex = 0 is the first path you can take out of the options.
At this point the game is playable by cURL.
Missing some error handling when out of index. Should just not throw error and reprompt user that they.
-
Reset command, a frontend, and deployed on servers. Make the console output prettier.
-
Use babel to transpile to use modern features (
import/export...) -
Add tests with a test framework (
jasmine,mocha,jest...) -
Linter + prettier (
eslint+prettier) using theStandardconvention -
Create a basic UI for the game.
-
Plug-in a database such as
MongoorPostgreinstead of putting everything in memory. -
Use an ORM (
sequelize...) -
Run everything on docker-compose with live-reload. Now that's a real dev workflow!
-
Do your own scenario :)