AS93

22
5
MIT
323 KB
Jun, 2022
4 months ago
Go

Go-APOD

A CORS-enabled, no-auth wrapper to NASA's Astronomy Picture of the Day
Public API: apod.as93.net

Contents

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://apod.as93.net/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 Vercel or Heroku deployment, or by running the executable directly.
A NASA API Key is required, which you can sign up for at api.nasa.gov.

Vercel

Deploy with Vercel

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

The service also includes an optional simple web app, which can be used to show todays image and associated information from the API.


Contributing

Contributions of any kind are very welcome, and would be much appreciated :) For Code of Conduct, see Contributor Convent.

To get started, fork the repo, make your changes, add, commit and push the code, then come back here to open a pull request. If you're new to GitHub or open source, this guide or the git docs may help you get started, but feel free to reach out if you need any support.

contributors


License

Lissy93/Go-APOD is licensed under MIT © Alicia Sykes 2022.
For information, see TLDR Legal > MIT

Expand License
The MIT License (MIT)
Copyright (c) Alicia Sykes <[email protected]> 

Permission is hereby granted, free of charge, to any person obtaining a copy 
of this software and associated documentation files (the "Software"), to deal 
in the Software without restriction, including without limitation the rights 
to use, copy, modify, merge, publish, distribute, sub-license, and/or sell 
copies of the Software, and to permit persons to whom the Software is furnished 
to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included install 
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANT ABILITY, FITNESS FOR A
PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

© Alicia Sykes 2022
Licensed under MIT

Thanks for visiting :)