-
Clone the repo
git clone https://github.com/grovertb/bingokata
-
Install NPM packages
yarn
or
npm i
- Running project
yarn dev
- Build project
yarn build
- Start project
yarn start
-
Generate Card [GET] [/api/bingo/generate/card]
- Response 200 (application/json)
{ "data": { "card": { "grid": [ [ 6, 12, 9, 3, 13 ], [ 23, 16, 21, 25, 24 ], [ 33, 42, "FREE", 45, 34 ], [ 46, 59, 47, 56, 48 ], [ 61, 62, 67, 68, 63 ] ], "cardId": 1 } }, "success": true }
- Response 200 (application/json)
-
Generate Number [GET] [/api/bingo/generate/number]
- Response 200 (application/json)
{ "data": { "number": 36, "history": [ 36 ] }, "success": true }
- Response 500 (application/json)
// is max generate number { "err": "Maximum of numbers generated", "success": false }
- Response 200 (application/json)
-
Validate card by cardId [GET] [/api/bingo/validate/card/:cardId]
- Response 200 (application/json)
{ "data": { "message": "Player is not the winner", "isWinner": false, "need": [ 14, 15, 5, 7, 2, 18, 29, 22, 17, 25, 32, 33, 40, 56, 51, 53, 59, 49, 75, 63, 62, 70, 64 ] }, "success": true } // winner { "data": { "message": "Player is the winner", "isWinner": true, "need": [] }, "success": true }
- Response 500 (application/json)
// is cardId not exists { "err": "Card not found", "success": false }
- Response 200 (application/json)
-
Validate all cards [GET] [/api/bingo/validate/cards]
- Response 200 (application/json)
{ "data": { "cards": [ { "message": "Player is not the winner", "isWinner": false, "need": [ 14, 15, 5, 7, 2, 18, 29, 22, 17, 25, 32, 33, 40, 56, 51, 53, 59, 49, 75, 63, 62, 70, 64 ] }, { "message": "Player is the winner", "isWinner": true, "need": [] }, { "message": "Player is not the winner", "isWinner": false, "need": [ 56, 51, 53 ] }, ] }, "success": true }
- Response 200 (application/json)
-
After complete the game or to restart the game [GET] [/api/bingo/init]
- Response 200 (application/json)
{ "success": true, "message": "Bingo Started" }
- Response 200 (application/json)