Skip to content

vinzdef/ipp

Repository files navigation

i++

Exercise web application where users can collectively increase the value of a counter on the server.

Server is in Go, Frontend in React. Communication is managed via WebSockets.

How to run this program locally

  • Download the latest zip from the releases page
  • Unzip in a directory of your choiche
  • Source .env.local Run ./output/backend from the root of the project (or yarn start:local)
  • Navigate to localhost:3000 in your browser

A minimal frontend is also exposed at http://localhost:3000/static/minimal.html

Development mode

  • yarn develop:frontend
  • yarn develop:backend

This will serve the web app under http://localhost:8080 (trough Webpack Dev Server) And the normal API + Static under http:////localhost:3000

Building

  • yarn install
  • yarn build:frontend
  • yarn build:backend

Requirements:

Go Server:

  • Has an internal counter
  • Serves static files
  • Has POST endpoint to increase counter
  • Has WebSocket to broadcast counter value
  • Host address is ser via env variables

Frontend:

  • React + Redux
  • ES6 + JSX
  • Reads value over WebSocket
  • Has increase button that sends POST
  • Looks nice, maybe with some CSS Framework
  • Built with Webpack
  • Has indicator for connection status
  • Handles connection close gracefully

Phases

0

  • Set up frontend boilerplate
  • Set up a simple static server
  • Have a minimal working environment
  • Setup releases including built files

1

  • WebSocket Endpoint Handler
  • WebSocket Connection Handler
  • POST Endpoint
  • POST Action
  • UI

2

  • Polish UI and server code
  • Ensure portability
  • Release V1
2.1
  • Add reset endpoint and gui

3

  • Refactor backend code for modularity
  • Allow address configuration from env variables
  • Seamlessly integrate change in frontend
  • Display a websocket status indicator
  • Handle disconnection gracefully

Learning material