Skip to content

imikodanic/tic-tac-toe-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Tic Tac Toe API

Tic Tac Toe API is an API made in GraphQL, which provides a connection between 2 users to play Tic Tac Toe.

Quick start

For the installation you must have npm installed.

Install dependencies:

$ npm install

Start the server:

$ npm start

View the GraphQL documentation at http://localhost:4000/graphql
Default port 4000 is defined in the start script in package.json

Architecture

There are 2 entities in the API

  • Player
  • Game

Resolvers are divided into parts

  • Player
    • Login
    • Register
  • Game
    • Create
    • GameSubscribe
    • Join
    • GetAll
    • GetSingle
    • MakeMove

When creating or joining the game, players subscribe to the game subscription and listen to events when moves are made.
Every move the board is calculated if there are any winners and the event is modified accordingly
Data storage is currently handled using Repositories but in the production it should be connected to the database.

About

Tic Tac Toe API made with GraphQL and TypeScript

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published