coin-flip-api
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data β all from the browser, and deployed in milliseconds.
coinflip.http.ts
https://willemhelmet--399bde0aa2ee11f089a10224a6c84d84.web.val.run
A hilarious API that randomly succeeds or fails with 50/50 probability.
Each time you call the API, it flips a virtual coin:
- Heads (50%): Returns success (200) with a winning message
- Tails (50%): Returns failure (500) with a losing message
Simply make a request to the endpoint:
curl https://your-username-coinflip.web.val.run
{ "success": true, "message": "π You won! The coin landed on heads!", "result": "heads" }
{ "success": false, "message": "π₯ You lost! The coin landed on tails!", "result": "tails" }
- Testing error handling in your applications
- Chaos engineering experiments
- Making important life decisions
- Having fun with unpredictable APIs