Click "Get Random Quote" or "Get Quote by ID" to display a quote here.
You can fetch quotes via the following endpoints:
/api/random (raw text) or /api/random/json (JSON) for a random quote/api/quote/:id (raw text) or /api/quote/:id/json (JSON) for a specific quote by IDExamples using bash and Python:
# BASH (random quote as raw text):
curl http://localhost:3000/api/random
# BASH (random quote as JSON):
curl http://localhost:3000/api/random/json
# BASH (specific quote by ID as raw text):
curl http://localhost:3000/api/quote/123
# Python (random quote as JSON):
import requests
url = "http://localhost:3000/api/random/json"
response = requests.get(url)
if response.status_code == 200:
data = response.json()
print("Quote ID:", data["id"])
print("Quote Text:", data["text"])
else:
print("Error:", response.status_code)