Skip to content

pbgnz/random-quote-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

random-quote-api

a simple api that returns random quotes from famous authors

API

GET /api/quotes
{
    "quotes": [
        {
            "author": "string",
            "quote": "string",
            "id": "number"
        }
    ]
}

Dev

Requirements:

  • NodeJS
  • NPM
  • Docker (Optional)
  • Docker compose (Optional)

Run using NPM:

Install dependencies

npm install

Run app on localhost:8000

npm start

Run using Docker:

Build image

docker build -t pbgnz/random-quote-api .

Run image

docker run -d -p 8000:8000 pbgnz/random-quote-api

Run using Dockerhub's image:

Pull the latest image from Dockerhub

docker pull pbgnz/random-quote-api:1.5.2

Run image

docker run -p 8000:8000 -d pbgnz/random-quote-api:1.5.2

Fetch endpoint

GET http://localhost:8000/api/quotes

Run using Docker-compose:

Add the image to your docker-compose.yaml file

# example
version: '3'
services:
  api:
    image: 'pbgnz/random-quote-api:1.5.2'
    ports:
      - '8000:8000'