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.js
installed.
- Clone the repo and
cd
into theroot
directory. - Use
npm install
to install necessary server dependencies. - When finished
cd client/
and again runnpm install
for front end dependencies. - To play the game locally you will need to open the
client/src/components/socket.js
file 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.) cd
back into theroot
directory 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 game
on 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 game
first will be the first player to take a turn.)