github.com/zeisss/tictactoe/storage

Microservice to play tictactoe over HTTP


Install
go get github.com/zeisss/tictactoe/storage

Documentation

Tic Tac Toe Microservice

A microservice providing a simple tictactoe game. For storage, memory or etcd can be used. Events can be send to Rabbitmq.

API

GET /v1/game/new

Creates a new game and returns the game-id.

  • Response 201 Created

    • Headers

        Location: /game/read?game=game1
      
    • Body

        game1
      

POST /v1/game/read?game={id}

  • Response 200 OK

      {
      	"status": "new",
      	"fields": [
      		[0,0,0],
      		[0,0,0],
      		[0,0,0]
      	],
      	"active_player": "player1",
      	"turn": 0
      }
    

POST /v1/game/move?game={id}&player={player}&position={x},{y}

Performs a move for the player onto the given coordinates. Returns a 400er error, if the coordinates or player is illegal. A 404 is the game does not exist. 204 otherwise.

  • Response 204 No Content

  • Response 404

      Game does not exist.
    
  • Response 400

      Illegal Coordinates.
      Illegal player.