{"id":28473310,"url":"https://github.com/nakedmcse/tsblackjack","last_synced_at":"2026-04-29T13:35:03.363Z","repository":{"id":287212020,"uuid":"863860137","full_name":"nakedmcse/TSBlackjack","owner":"nakedmcse","description":"TS version of the blackjack API","archived":false,"fork":false,"pushed_at":"2025-04-10T14:03:37.000Z","size":160,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-02T02:38:10.837Z","etag":null,"topics":["api","blackjack","dotenv","express","typeorm","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nakedmcse.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-09-27T03:47:14.000Z","updated_at":"2025-04-10T14:03:40.000Z","dependencies_parsed_at":"2025-04-10T15:48:46.867Z","dependency_job_id":"5b992e68-dc03-435e-b097-c0b579cd16f0","html_url":"https://github.com/nakedmcse/TSBlackjack","commit_stats":null,"previous_names":["nakedmcse/tsblackjack"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/nakedmcse/TSBlackjack","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nakedmcse%2FTSBlackjack","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nakedmcse%2FTSBlackjack/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nakedmcse%2FTSBlackjack/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nakedmcse%2FTSBlackjack/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nakedmcse","download_url":"https://codeload.github.com/nakedmcse/TSBlackjack/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nakedmcse%2FTSBlackjack/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32427757,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-29T13:34:34.882Z","status":"ssl_error","status_checked_at":"2026-04-29T13:34:29.830Z","response_time":110,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","blackjack","dotenv","express","typeorm","typescript"],"created_at":"2025-06-07T12:06:55.489Z","updated_at":"2026-04-29T13:35:03.346Z","avatar_url":"https://github.com/nakedmcse.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# TSBlackjack\n[![GitHub issues](https://img.shields.io/github/issues/nakedmcse/TSBlackjack.png)](https://github.com/nakedmcse/TSBlackjack/issues)\n[![last-commit](https://img.shields.io/github/last-commit/nakedmcse/TSBlackjack)](https://github.com/nakedmcse/TSBlackjack/commits/master)\n\nThis contains the TypeScript version of the BlackJack game API.\n\n## Environment\nThe `.env` file must be created for this application to run.  Rename `.envExample` to `.env`.\n\n### Env File Settings\nEdit the `.env` file to set the following:\n\n| Setting                   | Description                                                             |\n|---------------------------|-------------------------------------------------------------------------|\n| PORT                      | The port the service will listen on                                     |\n\n## Building\n\nTo build this API, clone this repo and then execute:\n\n```shell\nnpm install\nnpm run build\n```\n\nThis will compile the API to the /dist folder.\n\nYou can then execute the API using:\n\n```shell\nnpm run runjs\n```\n\nThe API can also be run directly without building for development using:\n\n```shell\nnpm run run\n```\n\n## Usage\n\nThis API contains 6 interactions.\n\n1. [Deal](#deal)\n2. [Hit](#hit)\n3. [Stay](#stay)\n4. [Stats](#stats)\n5. [History](#history)\n6. [Delete](#delete)\n\n\u003e **NOTE:** Depending on your shell, you may need to remove the quotes around the URLS in the CURL commands\n\n### Deal\u003ca id=\"deal\"\u003e\u003c/a\u003e\nThis endpoint takes no parameters, and will either start a new game if one does not exist for the device making the call,\nor will retrieve any game currently in progress for the device.\n\nThe returned data contains the players cards and the token to play the game.\n\n\u003e **NOTE:** The device ID is a hash of the user agent and the client IP\n\n```shell\ncurl -X 'POST' 'http://localhost:3000/deal'\n```\n```json\n{\n  \"token\":\"190324df-34c2-4c07-97a5-1a06a21c9f6d\",\n  \"device\":\"d08d4747b78e17c5459e8744604b90b35e669426f9c9d8e5b161b8828711c1ba\",\n  \"cards\":[\"J♦\",\"A♥\"],\n  \"dealerCards\":[],\n  \"handValue\":21,\n  \"dealerValue\":0,\n  \"status\":\"playing\"\n}\n```\n\n### Hit\u003ca id=\"hit\"\u003e\u003c/a\u003e\nThis endpoint optionally takes the game token as a parameter, and will draw another card for the players hand.\nIf the token is not specified then the device ID will be used instead to find the game.\n\nThe returned data contains the players cards and the token to play the game.\n\n```shell\ncurl -X 'POST' 'http://localhost:3000/hit?token=game-token-goes-here'\n\ncurl -X 'POST' 'http://localhost:3000/hit'\n```\n```json\n{\n  \"token\":\"2203e6c9-7383-48d9-9002-f441520a7791\",\n  \"device\":\"d08d4747b78e17c5459e8744604b90b35e669426f9c9d8e5b161b8828711c1ba\",\n  \"cards\":[\"3♥\",\"10♦\",\"3♦\"],\n  \"dealerCards\":[],\n  \"handValue\":16,\n  \"dealerValue\":0,\n  \"status\":\"playing\"\n}\n```\n\n### Stay\u003ca id=\"stay\"\u003e\u003c/a\u003e\nThis endpoint optionally takes the game token as a parameter, and will pass the turn to the dealer who will draw cards.\nBoth hands will be evaluated and a winner will be chosen.\nIf the token is not specified then the device ID will be used instead to find the game.\n\nThe returned data contains the players and the dealers cards, their relative values and the token to play the game.\nHowever the game is over at this point and an new /deal call must be made to start a new game.\n\n```shell\ncurl -X 'POST' 'http://localhost:3000/stay?token=game-token-goes-here'\n\ncurl -X 'POST' 'http://localhost:3000/stay'\n```\n```json\n{\n  \"token\":\"2203e6c9-7383-48d9-9002-f441520a7791\",\n  \"device\":\"d08d4747b78e17c5459e8744604b90b35e669426f9c9d8e5b161b8828711c1ba\",\n  \"cards\":[\"J♦\",\"A♥\"],\n  \"dealerCards\":[\"6♣\",\"J♣\",\"6♠\"],\n  \"handValue\":21,\n  \"dealerValue\":22,\n  \"status\":\"Dealer Bust\"\n}\n```\n\n### Stats\u003ca id=\"stats\"\u003e\u003c/a\u003e\nThis endpoint takes no parameters and will return the win, loss and draw count for the device making the call.\n\n```shell\ncurl 'http://localhost:3000/stats'\n```\n```json\n{\n  \"wins\":4,\n  \"loses\":2,\n  \"draws\":1\n}\n```\n\n### History\u003ca id=\"history\"\u003e\u003c/a\u003e\nThis endpoint optionally takes the start date as a parameter and will return the game history for the device making the call, after the start date if specified, as an array of responses.\n\n```shell\ncurl 'http://localhost:3000/history?start=2024-10-03'\n\ncurl 'http://localhost:3000/history'\n```\n\n```json\n[\n  {\"token\":\"6c359eb8-16bb-406a-93ff-6fbdaf1e5519\",\"device\":\"d08d4747b78e17c5459e8744604b90b35e669426f9c9d8e5b161b8828711c1ba\",\"cards\":[\"6♣\",\"5♦\",\"10♥\"],\"dealerCards\":[\"7♠\",\"5♥\",\"Q♣\"],\"handValue\":21,\"dealerValue\":22,\"status\":\"Dealer Bust\"},\n  {\"token\":\"de3db63b-4363-4c33-80cc-3ff51f02ea81\",\"device\":\"d08d4747b78e17c5459e8744604b90b35e669426f9c9d8e5b161b8828711c1ba\",\"cards\":[\"9♠\",\"5♥\",\"7♥\"],\"dealerCards\":[\"Q♥\",\"5♠\",\"10♥\"],\"handValue\":21,\"dealerValue\":25,\"status\":\"Dealer Bust\"},\n  {\"token\":\"420b767b-9506-47cc-a1e8-ed11d513fd30\",\"device\":\"d08d4747b78e17c5459e8744604b90b35e669426f9c9d8e5b161b8828711c1ba\",\"cards\":[\"4♣\",\"10♣\",\"9♦\"],\"dealerCards\":[\"6♣\",\"3♥\"],\"handValue\":23,\"dealerValue\":9,\"status\":\"Bust\"}\n]\n```\n\n### Delete\u003ca id=\"delete\"\u003e\u003c/a\u003e\nThis endpoint takes a parameter `sure` which must be set to true and will delete the game history for the device making the call.\nIt can also take an option path component with the game token.  If token is specified then just that game will be deleted.\n\n\u003e **NOTE:** If sure is not set to true, the history will not be deleted\n\n```shell\ncurl -X 'DELETE' 'http://localhost:3000/delete?sure=true'\n\ncurl -X 'DELETE' 'http://localhost:3000/delete/420b767b-9506-47cc-a1e8-ed11d513fd30?sure=true'\n```\n\n```json\ntrue\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnakedmcse%2Ftsblackjack","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnakedmcse%2Ftsblackjack","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnakedmcse%2Ftsblackjack/lists"}