Skip to content

My first Spring Boot web application. Manage PCs and Players.

Notifications You must be signed in to change notification settings

fajni/Game_Room

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SpringBoot Spring Boot "Game Room" Project SpringBoot

This Spring Boot Project is divided into 2 parts:

  • Handiling HTTP requests ➡️ branch: only_api
  • Registration, Login, Email and Secure endpoints ➡️ branch: login-registration-backend

Main branch contains both parts as one project.

For more info check ReadMe.md in branches.

Contents:

Project requirements

  • Spring Boot Version: 3.1.4.
  • Java Version: 21
  • Dependencies:
    • Spring Data JPA,
    • Spring Web,
    • Postgre SQL Driver,
    • Thymeleaf,
    • Dotenv:
      • groupId: io.github.cdimascio,
      • artifactId: java-dotenv,
      • version: 5.2.2
    • Spring Security,
    • Java Mail Sender,
    • Lombok

All the front-end is done by using Thymeleaf dependecy, simple HTML files with Bootstrap libraries.

Main idea

The "Game Room" project is designed to monitor the availability of eachPC and its current player. The provided tables present a list of available PCs and the Players currently using them. Player can't be stored into database/table if he's not using the PC.

Preparations

Using Spring Initializr to set up Spring Boot project:

  • Project: Maven
  • Language: Java,
  • Spring Boot: 3.1.4,
  • Packaging: Jar,
  • Java: 21

Installing Postgres: PostgreSQL Server for Windows

  • Port: 5432,
  • Locale: [Default locale],
  • It's not needed to install Stack Builder.

Basic commands:

\l for available databases,

\c for connecting to database (example: \c gameroom),

\d for listing relations (example: \d gameroom)

Creating database for project (from SQL Shell psql):

CREATE DATABASE gameroom;
GRANT ALL PRIVILEGES ON DATABASE "[username]" TO gameroom;

Preview

Person after registration becomes the App User.

pic

Pics From Final Project

Pics


Registration and Login custom page.
Email that has been send to Person's mail:

Available PCs after succesfull registration. Same goes with Players.

Note: Some pictures are outdated.

How to run

Clone project: git clone https://github.com/fajni/Game_Room.git

Clean Maven project: mvn clean package

Install Maven project.

From terminal locate youself in "taget" folder (cd target), and run the application: java -jar game-0.0.1-SNAPSHOT.jar

Note: To run multiple instances it's necessary to specify a port for each one individually: java -jar game-0.0.1-SNAPSHOT.jar --server.port=8081


Generating the Site: mvn site

Available endpoints

RegistrationController:

Request Link
GET localhost:8080/api/game/login
GET localhost:8080/api/game/sign_up
GET localhost:8080/api/game/confirm?token={token}
--- ---
POST localhost:8080/api/game/saveAppUser

PcController:

Request Link
GET localhost:8080/api/game/pc
GET localhost:8080/api/game/pc/
GET localhost:8080/api/game/pc/json
GET localhost:8080/api/game/pc/{pcNumber}
GET localhost:8080/api/game/pc/removePc
GET localhost:8080/api/game/pc/create_pc
GET localhost:8080/api/game/pc/update_pc
GET localhost:8080/api/game/pc/search?pcNumber={pcNumber}
--- ---
POST localhost:8080/api/game/pc
POST localhost:8080/api/game/pc/savePc
POST localhost:8080/api/game/pc/updatePc
--- ---
DELETE localhost:8080/api/game/pc/delete/{pcNumber}
--- ---
PUT localhost:8080/api/game/pc/{pcNumber}

PlayerController:

Request Link
GET localhost:8080/api/game/player, localhost:8080/api/game/player/
GET localhost:8080/api/game/player/json
GET localhost:8080/api/game/player/{playerNumber}
GET localhost:8080/api/game/player/pc/{playerNumber}
GET localhost:8080/api/game/player/removeplayer
GET localhost:8080/api/game/player/create_player
GET localhost:8080/api/game/player/update_player
GET localhost:8080/api/game/player/search?name={name}
--- ---
POST localhost:8080/api/game/player
POST localhost:8080/api/game/player/savePlayer
POST localhost:8080/api/game/player/updatePlayer
--- ---
DELETE localhost:8080/api/game/player/delete/{playerNumber}
--- ---
PUT localhost:8080/api/game/player/{playerNumber}

Wiki

Link to wiki for more.


Check out branches:

  • git checkout main
  • git checkout only_api - Only API part without login & registration backend,
  • git checkout login-registration-backend - Only login & registration backend without API part.

About

My first Spring Boot web application. Manage PCs and Players.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published