Giter VIP home page Giter VIP logo

tictactoe's Introduction

Tic Tac Toe application

Tech Stack:

  • SpringBoot
  • Docker
  • PostgreSQL
  • Lombok
  • Mapstruct
  • Spring Data JPA
  • H2 in-memory DB
  • Mockito
  • MockMvc
  • Swagger

Topics

  1. How to run this application
  2. How to access the spring boot restful application
  3. PostgreSQL version based Tic Tac Toe Application
  4. Advantages of this application

This is the springBoot based RESTful API. It supports the below functions:

  • Create a new game
  • List all games
  • Find a game via id
  • Find a game via game name
  • Perform a move in a game & determine the status of a game & return the winner if there is one

How to run this application

  • Navigate the the root folder /tictactoe under the command line
  • run the command to build the whole project: gradle clean build
  • run the command to start the application: java -jar ./build/libs/tictactoe-0.0.1-SNAPSHOT.jar

How to access the spring boot restful application

You may access swagger doc by accessing below url once application is up and running

http://localhost:8080/swagger-ui.html

This is swagger summary screenshot

When you expend game controller, there are all the controller list displayed as below:

When clicking any endpoint, for instance createGame, it will show the details and you can hit it to get the response. Just like the below screenshot.

There is the modal automatically generated by swagger. You may check the detail if you click one of them. the detail of it will be shown as the below screenshot.

PostgreSQL version based Tic Tac Toe Application

I also prepared PostgreSQL version. Please follow below steps if you want to try PostgreSQL version

  • Navigate the the root folder /tictactoe under the command line
  • rename application.properties to another name e.g. application_backup.properties
  • rename application-postgresql.properties to application.properties
  • run the command to docker-compose up
  • run the command to build the whole project: gradle clean build
  • when the above step is done, run the command java -jar ./build/libs/tictactoe-0.0.1-SNAPSHOT.jar

Advantages of this application

  • Integrated with swagger doc which easily provides with the RESTful API UI and can be easily shared with other developers to use use API
  • Hibernate builds the entity layer to connect PostgreSQL database server
  • Spring Data JPA builds the repository layer (DAO) & H2 in-mem database used as Unit Test to test this layer
  • Mapstruct used to map data between entities and dtos
  • All the exceptions can be centrally handled in one place (ControllerExceptionHandler.java)
  • Lombok makes our life easierIt automatically generates getter,setter, constructor, hashcode, log etc.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.