/52-card-shuffle

PHP API + UI to shuffle a deck of cards.

Primary LanguageHTMLMIT LicenseMIT

A project component to the Intro to PHP shortcourse at The Open Window.

52 Card Shuffle

An API + UI to shuffle a deck of cards.

Notes

All responses will be JSON in the form of:

{
	"code": "2xx/4xx/5xx",
	"status": "success/error",
	"body": Endpoint Response (see below)
}

Endpoints

/shuffle

Shuffle and save new deck.

Returns:

{
	"id": "{new-guid}",
	"deck": [
		{
			"card": "ace",
			"suit": "spades",
			"number": 13,
			"colour": "black"
		},
		// etc
	]
}

/shuffle?id={id}

Shuffle and update an existing deck.

If no such {id} exists, an error will be thrown.

Returns:

{
	"id": "{id}",
	"deck": [
		{
			"card": "three",
			"suit": "hearts",
			"number": 3,
			"colour": "red"
		},
		// etc
	]
}

/deck?id={id}

Get the cards of a shuffled deck.

If no such {id} exists, an error will be thrown.

Returns:

{
	"id": "{id}",
	"deck": [
		{
			"card": "king",
			"suit": "clubs",
			"number": 12,
			"colour": "black"
		},
		// etc
	]
}

/deck/delete?id={id}

Delete an existing deck of cards.

If no such {id} exists, an error will be thrown.