Sign inSign up

lissy93/apod

By lissy93

•Updated 8 days ago

Astronomy Picture of the Day App and API

Image
0

3.0K

lissy93/apod repository overview

⁠Go APOD

A CORS-enabled, no-auth wrapper to NASA's Astronomy Picture of the Day
🌌 Public API: go-apod.herokuapp.com⁠
🐙 Source: github.com/Lissy93/go-apod⁠

⁠API Usage

⁠/apod

Returns full JSON info about todays picture

Example

GET https://go-apod.herokuapp.com/apod

Response

{
  "date": "2022-06-20",
  "explanation": "There, just right of center, what is that? The surface of Mars keeps revealing new surprises with the recent discovery of finger-like rock spires. The small nearly-vertical rock outcrops were imaged last month by the robotic Curiosity rover on Mars. Although similar in size and shape to small snakes, the leading explanation for their origin is as conglomerations of small minerals left by water flowing through rock crevices. After these relatively dense minerals filled the crevices, they were left behind when the surrounding rock eroded away.  Famous rock outcrops on Earth with a similar origin are called hoodoos. NASA's Curiosity Rover continues to search for new signs of ancient water in Gale Crater on Mars, while also providing a geologic background important for future human exploration.   Explore Your Universe: Random APOD Generator",
  "hdurl": "https://apod.nasa.gov/apod/image/2206/MarsFingers_Curiosity_1338.jpg",
  "media_type": "image",
  "service_version": "v1",
  "title": "Rock Fingers on Mars",
  "url": "https://apod.nasa.gov/apod/image/2206/MarsFingers_Curiosity_960.jpg"
}

⁠/image

Returns todays image

Example

<img
  src="https://go-apod.herokuapp.com/image"
  alt="Astronomy Picture of the Day"
  width="350"
/>

Response

Astronomy Picture of the Day

⁠Deployment

Go-APOD can be self-hosted, either with Docker, via the 1-click Heroku deployment, or by running the executable directly.
A NASA API Key is required, which you can sign up for at api.nasa.gov⁠.

⁠Heroku

Deploy to Heroku

⁠Docker

A multi-arch container is available on DockerHub, under lissy93/apod⁠, or GHCR as ghcr.io/lissy93/go-apod⁠.
Or, use this docker-compose.yml⁠ template, and just populate with your API key and run docker compose up.

docker run -p 8080:8080 -e NASA_API_KEY='XXX' -d lissy93/apod
⁠From Executable

Each release has pre-compiled binaries attached for Windows, Mac and Linux, which can be run directly. From the Releases Page⁠, download and extract the version for your system, then execute it with: NASA_API_KEY='XXX' ./go-apod

⁠From Source

See the Building Locally⁠ section below


⁠Building Locally

If you haven't already done so, you'll need to install Go Lang⁠.
Then clone the repo git clone https://github.com/Lissy93/go-apod.git && cd go-apod

⁠Commands
  • Run Directly > go run .
  • Compile App > go build
  • Run Tests > go test
⁠Environmental Variables
  • NASA_API_KEY (Required) - Your API Key, you can sign up for one at api.nasa.gov⁠
  • PORT (Optional) - The port to start the web server on, defaults to 8080
  • CORS_ALLOWED_ORIGINS (Optional) - List of origins which can use the API, defaults to * / all
  • NASA_BASE_URL (Optional) - The base URL upstream GET requests, defaults to NASA's APOD API

⁠App

There's also a simple web app included, which can be self-hosted or accessed below, which displays today's image and info.

⁠


⁠License

Licensed under MIT⁠, © Alicia Sykes⁠ 2022

Tag summary

Content type

Image

Digest

sha256:70e3e6bba…

Size

6.8 MB

Last updated

8 days ago

docker pull lissy93/apod