Skip to content

vincentdoerig/rowing-quotes-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Rowing Quotes API

An API for quotes related to rowing created with Node.js.

Usage

Get a random quote

Returns a single random quote from the database

Request

https://rowing-quotes-api.herokuapp.com/random

Response

{
    "id": number,
    "quote": string,
    "author": string,
    "additionalInfo": string
}

Get x amount of quotes

https://rowing-quotes-api.herokuapp.com/random/:amount

Get the quote with the id of x

https://rowing-quotes-api.herokuapp.com/quote/:id

Get all the available quotes

https://rowing-quotes-api.herokuapp.com/all

Examples

Get a random quote using fetch

fetch('https://rowing-quotes-api.herokuapp.com/random')
  .then(response => response.json())
  .then(data => {
    console.log(`${data.quote}${data.author}`)
  })

Get a random quote unsing async/await

async function randomQuote() {
  const response = await fetch('https://rowing-quotes-api.herokuapp.com/random')
  const data = await response.json()
  console.log(`${data.quote}${data.author}`)
}

Development

Install

$ yarn install

Deployment

$ yarn start

Development

$ yarn dev

Contributing

Pull requests and feedback are welcome. For major changes, please open an issue first to discuss what you would like to change.

License

MIT