A Connect4 game in two versions:
- Static
- RESTful API
Built with Node.js using the Express framework, JavaScript, HTML and CSS.
Feature | Client-Server | Static |
---|---|---|
Place pieces on Connect 4 grid | ✓ | ✓ |
Respond to click events | ✓ | ✓ |
Detect victory conditions | ✓ | ✓ |
Display victory conditions | ✓ | ✓ |
Display winner | ✓ | ✓ |
Add Player names and declare the winner | ✓ |
Hosted in Vercel: connect4-static.vercel.app
RESTful API with NodeJS using Express.
-
Access project's subdirectory:
cd clientserver/
-
Install packages:
npm install
-
Start server:
npm start
(npm will runnode server.js
)
Expected output: "Express server up on port: 8080" -
On browser, go to
http://localhost:8080
- [client - grid] EventListener on board grid (listens to "click");
- [client - positionClick] Client click action will POST row & column;
- [server - taketurn] Server responds with json containing the game’s updated state.