The App's back-end uses Node.js and runs on port 5000 while the front-end uses React.js and runs on port 3000. Game state is stored and updated on the back-end which then communicates with the React front-end via Socket.io to update state in the window.
- Understanding of Elements' rules of play.
- Ability to clone GitHub repositories.
- Must have
Node.jsinstalled.
- Clone the repo and
cdinto therootdirectory. - Use
npm installto install necessary server dependencies. - When finished
cd client/and again runnpm installfor front end dependencies. - To play the game locally you will need to open the
client/src/components/socket.jsfile in your preferred text editor and change line that readsconst socket = io.connect( "https://elements-game.herokuapp.com/" );to readconst socket = io.connect( "http://localhost:5000" );then save the file. (This line will be within the first few lines of the file.) cdback into therootdirectory and usenpm run dev. This will open a browser session of the app onlocalhost:3000.- You will then need to open another browser to the same address.
- Once both browsers are open you may click
start gameon both, at which point both windows will act as a seperate client and cards will be dealt to each. - Commence playing. (Note that whichever browser instance clicked
start gamefirst will be the first player to take a turn.)