Skip to content

Latest commit

 

History

4 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Back-end for Connect Four clone game using Gin/Go

Two players can start a game and play it using REST calls. No authentication is performed.

Start the server.

$ go run .

Make HTTP requests to start a game.

$ curl http://localhost:8080/connectfour/new && echo
{"id":1,"nextPlayer":1,"winner":0,"board":[[0,0,0,0,0,0,0],[0,0,0,0,0,0,0],[0,0,0,0,0,0,0],[0,0,0,0,0,0,0],[0,0,0,0,0,0,0],[0,0,0,0,0,0,0]]}

Place a piece on the board (columns start at zero).

$ curl http://localhost:8080/connectfour/1 -X POST -d "player=1&column=0" && echo
{"id":1,"nextPlayer":2,"winner":0,"board":[[0,0,0,0,0,0,0],[0,0,0,0,0,0,0],[0,0,0,0,0,0,0],[0,0,0,0,0,0,0],[0,0,0,0,0,0,0],[1,0,0,0,0,0,0]]}

Obtain the current state of a game.

$ curl http://localhost:8080/connectfour/1 && echo
{"id":1,"nextPlayer":2,"winner":0,"board":[[0,0,0,0,0,0,0],[0,0,0,0,0,0,0],[0,0,0,0,0,0,0],[0,0,0,0,0,0,0],[0,0,0,0,0,0,0],[1,0,0,0,0,0,0]]}

About

Back-end for a clone of the Connect Four game using Gin/Go

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages