Just a simple JSON API that returns Michael Scott quotes that can be retrieved and rendered in a front-end application. The Access-Control-Allow-Origin
header is set to *
so that you can make requests from any domain.
Built with Cloudflare Workers.
Returns a random quote:
{
"quote":"Saved a life. My own. Am I a hero? I really can't say, but yes."
}
Returns an array with <count>
quotes e.g. GET /quotes/3
[
"I don't want any special treatment, Pam. I just want you to treat me like you would some family member who's undergone some sort of serious physical trauma. I don't think that's too much to ask?",
"Nobody likes beets, Dwight! Why don't you grow something that everybody does like? You should grow candy.",
"We do not always get what we want. Sometimes life presents us with surprises."
]
Returns an array of quotes matching <term>
without case sensitivity e.g. GET /quotes/search/Jim
[
"Jim and I are great friends. We hang out a ton, mostly at work."
]
[
"The worst thing about prison was the dementors.",
"I am Beyonce, always.",
"...",
"Is there a God? If not, what are all these churches for? And who is Jesus's dad?"
]
Clone this repo and run:
npm install wrangler
: install Wrangler locallywrangler dev
: start a local server