https://github.com/prettymuchbryce/blackjack
A simple API which allows a user to play blackjack against a dealer.
https://github.com/prettymuchbryce/blackjack
Last synced: over 1 year ago
JSON representation
A simple API which allows a user to play blackjack against a dealer.
- Host: GitHub
- URL: https://github.com/prettymuchbryce/blackjack
- Owner: prettymuchbryce
- Created: 2014-04-19T02:20:52.000Z (about 12 years ago)
- Default Branch: master
- Last Pushed: 2014-04-20T18:07:37.000Z (about 12 years ago)
- Last Synced: 2025-03-17T16:55:45.703Z (over 1 year ago)
- Language: JavaScript
- Size: 152 KB
- Stars: 1
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# Blackjack Web Service
A simple API which allows a user to play blackjack against a dealer.
## Features
Player may start a game, then choose to hit or stand.
- There is no doubling down on hands
- There is no insurance
- There is no splitting
- There is no betting
## Stack
This service is written in node.js. It also uses a few node modules.
- **express** - web framework
- **underscore** - functional programming helpers
- **hashids** - generates unique string ids
- **moment** - offers some date/time helpers
## Installation
1. `git clone git@github.com:prettymuchbryce/blackjack.git`
2. `cd blackjack`
3. `npm install`
4. `npm start`
## Curl Requests
### New Game (GET)
`curl 'http://127.0.0.1:3000/new' -H 'Content-Type: application/json'`
### Hit (POST)
*Use the id you received from creating a new game to hit and stand.*
`curl 'http://127.0.0.1:3000/hit' -H 'Content-Type: application/json' -d '{ "id": "1z" }'`
### Stand (POST)
*Use the id you received from creating a new game to hit and stand.*
`curl 'http://127.0.0.1:3000/stand' -H 'Content-Type: application/json' -d '{ "id": "1z" }'`
## Tests
Requires Mocha
`npm test`