Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

6 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

Configurazione e Avvio — Risiko Online

Piattaforma multiplayer in tempo reale che si ispira al gioco da tavolo Risiko, basata su Node.js, Express, React, MySQL e Socket.io. Sviluppato da Giovanni Burletti.


1. Prerequisiti

  • Node.js (v16 o superiore) e npm.
  • Server MySQL attivo in locale (es. tramite XAMPP, MySQL Workbench o Docker).

2. Configurazione Database

Esegui lo script SQL contenuto nel file backend/schema.sql all'interno del tuo client MySQL per inizializzare il database risiko_db e le tabelle (users, lobbies, lobby_players):

mysql -u root -p < backend/schema.sql

3. Variabili d'Ambiente (.env)

Crea i file .env nelle rispettive cartelle:

Backend (backend/.env)

Per avvio a porta singola (Produzione):

PORT=3001
CLIENT_ORIGIN=
DB_HOST=localhost
DB_PORT=3306
DB_USER=root
DB_PASSWORD=
DB_NAME=risiko_db

Nota: DB_HOST rimane localhost anche quando ci si collega da altri dispositivi della rete locale, poiché MySQL e il server Node risiedono sulla stessa macchina.

Per sviluppo classico (Due porte separate):

PORT=3001
CLIENT_ORIGIN=http://localhost:3000
DB_HOST=localhost
DB_PORT=3306
DB_USER=root
DB_PASSWORD=
DB_NAME=risiko_db

Frontend (frontend/.env)

Per avvio a porta singola (Produzione):

REACT_APP_API_URL=
GENERATE_SOURCEMAP=false

Nota: Lasciando REACT_APP_API_URL vuoto, le chiamate API e Socket.io utilizzeranno l'URL relativo dello stesso host.

Per sviluppo classico (Due porte separate):

REACT_APP_API_URL=http://localhost:3001

4. Installazione Dipendenze

Installa i moduli necessari in entrambe le directory:

# Setup Backend
cd backend
npm install

# Setup Frontend
cd ../frontend
npm install

5. Modalità di Avvio

Opzione A: Porta Singola Unificata (Consigliata)

Express serve sia le API, sia i WebSocket, sia i file statici di React sulla porta 3001.

  1. Genera la build del frontend:

    cd frontend
    npm run build
  2. Avvia il server backend:

    cd ../backend
    npm start
  3. Gioca: Accedi da browser su http://localhost:3001.


Opzione B: Ambiente di Sviluppo (Due Processi)

Consigliato durante la modifica di componenti grafici per usufruire dell'Hot-Reloading.

  1. Terminale 1 (Backend):

    cd backend
    npm start
    # Server attivo su http://localhost:3001
  2. Terminale 2 (Frontend):

    cd frontend
    npm start
    # Interfaccia attiva su http://localhost:3000
  3. Gioca: Accedi da browser su http://localhost:3000.

6. Copyright e Licenza

© 2026 Risiko Online. Tutti i diritti riservati.

Nota Legale: Questo progetto è sviluppato a scopo personale/educativo. "Risiko!" è un marchio registrato appartenente ai rispettivi proprietari (Editrice Giochi / Spin Master). Questo software non è affiliato, autorizzato, mantenuto, sponsorizzato o approvato dai detentori del marchio originale.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages