Disclaimer: this app was hacked together over some hours in the final weeks of Season 8 of Game of Thrones. It does not contain high quality or readable code, but it works. I'm a back-end guy who knows some framework-level Javascript.
Packages are installed with yarn, run yarn
in the root, client/
, and server/
directories
- The app is hosted on structure.sh, which allows running an Express app off the http/https ports (standard 80/443)
- UI client pages are served off
get
/*
which allows react-router to route to any page post
/api/putData
handles users submitting their guesses off the main page- The app works as both a front and a back end this way!
- The server is run from the top-level directory using
npm run start
- The client UI exists in the
/client
folder - You can run the whole app locally by running
npm run start
from the top level directory. Looking insidepackage.json
you'll see that this first builds the client UI and then starts the server - You can build and run just the client UI by running
npm run start
from the/client
directory. This will start a development server through webpack - Important: the client is currently hardcoded to post data to the server at
https://gotdeathdraft.tk
. I didn't bother setting up CORS and local back-end testing. You can replace this URL with wherever you are running the server.
- Create an account at structure.sh and set up credentials
- From the top level directory, run
structure deploy you-app-name
make sure you have changed the url of the server as mentioned in the last bullet point. For example: if your app is hosted athttps://my-death-draft-app-username.structure.sh
, then you will have to hardcode the server ashttps://my-death-draft-app-username.structure.sh
in the client UI before deploying.