Deadliner — Quotes API

Simple read-only API with inspirational quotes. This page shows how to use it in Deadliner (examples, fetch snippets, common errors).

Overview

This API exposes a small collection of quotes. It's read-only and provides two endpoints: list all quotes and fetch a single quote by ID. All responses are JSON.

Connection

Use the following base URL for all requests:

https://api-quotes-beta.vercel.app/quotes

Endpoints

GET /quotes

Returns an array of quote objects.

[
  {"id":"1","quote":"You should be spending your time programming features that your customers will care about","author":"DHH","source":"DHH discusses SQLite (and Stoicism)"},
  {"id":"2","quote":"The light in which we see things makes their value","author":"Epictetus","source":"Discourses and selected writings"}
]

GET /quotes/:id

Returns a single quote object by its ID.

{
  "id": "1",
  "quote": "You should be spending your time programming features that your customers will care about",
  "author": "DHH",
  "source": "DHH discusses SQLite (and Stoicism)"
}
Status codes:
  • 200 — OK
  • 404 — Quote not found
  • 500 — Server error

Quick examples

Fetch with JavaScript (browser)

Example that shows list and single quote fetch. Make sure your app/server and the API allow CORS.

// fetch all
fetch('https://api-quotes-beta.vercel.app/quotes')
  .then(r => r.json())
  .then(data => console.log(data))
  .catch(err => console.error('Fetch error', err));

// fetch by id
fetch('https://api-quotes-beta.vercel.app/quotes/1')
  .then(r => r.json())
  .then(q => console.log(q))
  .catch(err => console.error('Fetch error', err));

cURL

curl https://api-quotes-beta.vercel.app/quotes
curl https://api-quotes-beta.vercel.app/quotes/1

Node (server-side)

const fetch = (...args) => import('node-fetch').then(({default: fetch}) => fetch(...args));

(async () => {
  const res = await fetch('https://api-quotes-beta.vercel.app/quotes');
  const data = await res.json();
  console.log(data);
})();

Using this in Deadliner

You can integrate quotes into Deadliner as a motivational widget or a tooltip for tasks. Below is a small example component (plain JS) that injects a random quote into an element with ID #quoteWidget.

async function loadRandomQuote() {
  try {
    const res = await fetch('https://api-quotes-beta.vercel.app/quotes');
    const list = await res.json();
    const random = list[Math.floor(Math.random() * list.length)];
    document.getElementById('quoteWidget').textContent = `"${random.quote}" — ${random.author}`;
  } catch (err) {
    console.error(err);
    document.getElementById('quoteWidget').textContent = 'Could not load quote.';
  }
}

// call on page load
loadRandomQuote();
Tip: If you display quotes frequently, cache the list in localStorage for the session to reduce requests.

CORS & Troubleshooting

If the browser console shows a CORS error, make sure the API returns Access-Control-Allow-Origin header. On Vercel/Express add app.use(cors()) or the header manually.

Common errors

  • Failed to fetch / No CORS header — Browser blocked the request. Fix server CORS headers.
  • 404 Quote not found — ID does not exist.
  • 500 Server error — Something went wrong on the API side; check server logs.

Rate limiting & usage

This demo API has no formal rate limit, but be considerate: cache responses client-side when possible. For production use, deploy your own instance or add caching layer (CDN/Edge).

Example HTML snippet (widget)

<div id="quoteWidget" class="p-4 bg-white rounded shadow">Loading...</div>
<script>
  // paste the loadRandomQuote function from above
</script>

Changelog & contact

2025-11-17 — Initial documentation created.

Questions / issues: open an issue in the Deadliner repo or contact the maintainer.