๐Ÿค– AI Voting API

This API runs a live YES/NO voting game. Scouts build their own front end using ChatGPT.

๐Ÿš€ QUICK START FOR SCOUTS:
1. Read the API below
2. Scroll to CHATGPT PROMPT at the bottom
3. Copy it, paste into ChatGPT
4. Open the HTML file ChatGPT generates in your browser

BASE URL

https://ai.wesbarron.com

ENDPOINTS

POST /api/vote

Cast a YES or NO vote.

POST https://ai.wesbarron.com/api/vote
Content-Type: application/json

Body:
{
  "isYes": true     โ† true = YES, false = NO
}

Response (200):

{ "ok": true, "yes": 12, "no": 4 }

GET /api/results

Scoutmaster only โ€” or use the dashboard below instead.

Response (200):

{ "yes": 12, "no": 4 }

GET /api/reset?key=troop007

Clear all votes. Scoutmaster only. Run this between questions.

Response (200):

{ "ok": true, "message": "Tally reset" }

HOW IT WORKS

There are no predefined questions. You decide what to vote on. Each vote is a single YES or NO. The API tracks one running tally shared across all devices. Reset between questions.


๐Ÿค– CHATGPT PROMPT โ€” COPY THIS

Select all text below, copy it, and paste into ChatGPT:

Here is a voting API for a live classroom poll:

BASE URL: https://ai.wesbarron.com

POST /api/vote
  Full URL: https://ai.wesbarron.com/api/vote
  Method: POST
  Header: Content-Type: application/json
  Body (raw JSON): {"isYes": true}
  Response: {"ok": true, "yes": 7, "no": 3}

  IMPORTANT:
  - The full URL is: https://ai.wesbarron.com/api/vote (lowercase, with /vote at the end)
  - Body is raw JSON. No form data. No URL encoding.
  - The key is literally the string "isYes" (all lowercase, capital S)

  Example fetch:
  fetch('https://ai.wesbarron.com/api/vote', {
    method: 'POST',
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify({ isYes: true })
  })

GET /api/results (Scoutmaster only โ€” scouts do not use this)

GET /api/reset?key=troop007 (Scoutmaster only)

Please create a single local HTML file with:
- Two big buttons: YES and NO
- After clicking, call fetch() to POST to https://ai.wesbarron.com/api/vote
- Show "vote recorded" on success
- Clean, modern dark theme (dark navy background, green YES button, red NO button)
- A title at the top

No server needed โ€” purely client-side HTML file

SCOUTMASTER DASHBOARD

Projector display with live bar chart and reset button:

https://ai.wesbarron.com/display.html

Built for Scouts BSA Troop 344 ยท AI Merit Badge ยท Scoutmaster Wes Barron ยท 2026