Skip to content

Retrieves random quotes in different languages

License

Notifications You must be signed in to change notification settings

victrme/i18n-quotes

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A Quotes API used by Bonjourr

This API returns quotes using 3 different providers:

  • Random quotes found on the internet
  • Inspirational quotes by inspirobot
  • Famous quotes from the tv show kaamelott

⚠️ For performance reasons, quotes are fetched from this repo using jsDelivr CDN. This will cause problem when forking this repo.

Run and deploy

This API can easily be deployed as a Cloudflare Worker.

deno install --global npm:wrangler

# ✅ Successfully installed wrangler

# test
deno test --allow-net

# ok | 3 passed (9 steps) | 0 failed (1s)

# dev
wrangler dev

# ⎔ Starting local server...
# Ready on http://127.0.0.1:8787

# deploy
deno run deploy --allow-net

# Total Upload: 1.96 KiB / gzip: 0.89 KiB
# Uploaded i18n-quotes (8.39 sec)

API Endpoints

All endpoints return a list of quotes with the same type

type Quotes = {
	author: string
	content: string
}[]

Classic

Returns 20 random english quotes

GET /classic
[
  {
    "author": "Joseph Campbell",
    "content": "Find a place inside where there's joy, and the joy will burn out the pain."
  },
  {
    "author": "Theodore Roosevelt",
    "content": "With self-discipline most anything is possible."
  }
  // ...
]

Returns 20 random quotes from a specified language

GET /classic/:lang
[
  {
    "author": "Socrate",
    "content": "Tout ce que je sais, c'est que je ne sais rien."
  },
  {
    "content": "L’enthousiasme a toujours engendré la certitude.",
    "author": "Alfred Espinas"
  }
  // ...
]

Inspirobot

Returns 20 quotes from Inspirobot

GET /inspirobot
[
  {
    "author": "Inspirobot",
    "content": "Depressions can become memorable."
  },
  {
    "author": "Inspirobot",
    "content": "Notice how your left nostril is connecting to your heart."
  }
  // ...
]

Kaamelott

Returns 20 quotes from a list of kaamelott quotes shamelessly stolen from sin0light/api-kaamelott.

GET /kaamelott
[
  {
    "author": "Le Roi Burgonde",
    "content": "Arthour !… Pas changer assiette pour fromage !"
  },
  {
    "author": "Perceval",
    "content": "Là, vous faites sirop de vingt-et-un et vous dites: beau sirop, mi-sirop, siroté, gagne-sirop, sirop-grelot, passe-montagne, sirop au bon goût."
  }
  // ...
]