The famous game since the early days of Microsoft where you have to flag the cells with mine while opening the cells with value and get the highest score possible.
- Create random board configuration using current time as the seed pivot.
- Publishing the save request to a kafka topic instead of processing with the database to prevent overhead.
- Using chain of RESTful requests and return resultant data.
- Configure services like Mongo, Kafka before using them in Http routes.
- Prevent processing of network requests in case of error conditions.
This repository is part of a larger ecosystem of microservices each serving it's purpose in bring Minesweeper to life.
You can use the docker-compose.yml
file to start all the services in separate docker containers in one go. This file is available in a different repository. Please let me know if you'd like to experiment with that.
This repository contains the Web services APIs for the game in golang.
/game/new
- Creates a board for rows, columns and mines count./game/save
- Publishes a game to the Update Database Service./games
- Returns the leaderboard for games linked to a configuration.
MONGO_CLIENT_ID
- MongoDB Cloud Atlas client idDATABASE
- MongoDB DatabaseMONGO_COLLECTION
- MongoDB CollectionKAFKA_TOPIC
- Kafka Cluster topicKAFKA_BROKER_ID
- Kafka Cluster broker idUSERS_URL
- Users service URLCLIENT_SECRET
- Client secret to verify access token.CORS_ORIGIN
- CORS Origin to allow.
The service can be run either directly as a go project or use a Docker container to build and run.
The projects uses go modules to manage the dependencies.
Run the following commands in order to build the project to build from the command line.
go get -d -v ./...
go mod download
go mod vendor
go mod verify
go build
go run main.go
Or the following to build the docker container.
docker build -t minesweeper .
docker run -it minesweeper
Ensure that the go.sum
and vendor/modules.txt
do not have it's content altered unless there is a dependency alteration.
- Atul Anand