Skip to content

llama-as-a-service/images-service

Repository files navigation

LaaS Image API Service

CI Vercel Deploy Heroku Deploy Publish Docker Stable Version Latest Release

Image API Service. Built with NodeJS, Express, and Docker. Connects to the MongoDB Image Database.

⚠️ Heroku Deployment may be depreciated

✅ Try It Out:

curl https://llama-as-a-service-images.herokuapp.com/random
JSON Response
{
  "message": "https://images.theconversation.com/files/337593/original/file-20200526-106811-ql6d51.jpg?ixlib=rb-1.1.0&q=45&auto=format&w=1200&h=900.0&fit=crop"
}

🎥 Walkthrough Video

YouTube Video

⚙️ Setup

$ git clone https://github.com/llama-as-a-service/images-service.git
$ cd images-service
$ cp .env.sample .env
$ docker-compose up -d
# access on localhost:3000

🧪 Test

$ docker-compose exec images_service yarn run test

📦 Pull from GitHub Repository Container Registry

# docker pull ghcr.io/OWNER/IMAGE_NAME
$ docker pull ghcr.io/llama-as-a-service/images-service:0.1.0

API Documentation

Random Endpoint

URL /random
Method GET
Status 200 OK
Authentication None

Optional Parameters

Defualt = 1 Max = 25

?count=9

Sample Response:

{
    "message": [
      "https://cdn.britannica.com/41/1/Alpaca.jpg?w=400&h=300&c=crop",
      "https://images.pexels.com/photos/3396661/pexe61.jpg&fm=jpg",
      "https://www.openaccess.org/wp-content/scaled.jpg",
      ...
    ],
}

Upload Endpoint

URL /upload
Method POST
Status 201 CREATED
Authentication Admin

Example body:

{
    "url": "https://cdn.britannica.com/41/1/Alpaca.jpg?w=400&h=300&c=crop",
}

Sample Response:

{
    "message": "Successfully upload image!",
}

Alternative Setup

$ yarn install
$ yarn run start # yarn run dev