Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/vincentdoerig/rowing-quotes-api

A JSON API for quotes related to rowing.
https://github.com/vincentdoerig/rowing-quotes-api

quote-generator quotes rest-api rowing

Last synced: about 2 months ago
JSON representation

A JSON API for quotes related to rowing.

Awesome Lists containing this project

README

        

# 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
```http
https://rowing-quotes-api.herokuapp.com/random
```
#### Response
```ts
{
"id": number,
"quote": string,
"author": string,
"additionalInfo": string
}
```

### Get x amount of quotes
```http
https://rowing-quotes-api.herokuapp.com/random/:amount
```

### Get the quote with the id of x
```http
https://rowing-quotes-api.herokuapp.com/quote/:id
```

### Get all the available quotes
```http
https://rowing-quotes-api.herokuapp.com/all
```

## Examples

**Get a random quote using fetch**

```js
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**

```js
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

```console
$ yarn install
```

### Deployment

```console
$ yarn start
```

### Development

```console
$ 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](https://github.com/vincentdoerig/rowing-quotes-api/blob/master/LICENSE)