Description

A simple golang web application which consumes data from the APOD API. It also provides a small API with the ability to save and filter data.

Paths table

Path Method Description Body example
/picture GET Get picture of the day

{
  "copyright":"ALSJ",
  "date":"2022-07-30",
  "explanation":"Get out your red/blue glasses...",
  "hdurl":"https://apod.nasa.gov/apod/image/2207/AS11JK44-6633-34.jpg",
  "media_type":"image",
  "service_version":"v1",
  "title":"The Eagle Rises",
  "url":"https://apod.nasa.gov/apod/image/2207/AS11JK44-6633-34_1100px.jpg"
}
/album GET Get all saved pictures

[
    {
        "Id": 1,
        "RequestedAt": "2022-07-30T00:00:00Z",
        "Title": "The Eagle Rises",
        "Url": "https://apod.nasa.gov/apod/image/2207/AS11JK44-6633-34_1100px.jpg"
    },
    {
        "Id": 2,
        "RequestedAt": "2022-07-30T00:00:00Z",
        "Title": "SOFIA's Southern Lights",
        "Url": "https://apod.nasa.gov/apod/image/2207/ASC05954-Edit1024.jpg"
    }
]
/album?date=[DATE] GET Get pictures saved on a specified day

[
    {
        "Id": 1,
        "Title": "The Eagle Rises",
        "Url": "https://apod.nasa.gov/apod/image/2207/AS11JK44-6633-34_1100px.jpg"
    },
    {
        "Id": 2,
        "Title": "SOFIA's Southern Lights",
        "Url": "https://apod.nasa.gov/apod/image/2207/ASC05954-Edit1024.jpg"
    }
]

In order to save the image along with all its meta-data, you need to add the ?saved=true argument to the /picture route. You can also pass api_key as a parameter. The DEMO_KEY is used by default.

How to run

Using Make:

make up

GitHub

View Github