Application to collect images URL from NASA's APOD API.
Start with cloning the repository
git clone https://github.com/Vrangz/S3J6eXN6dG9mIFN6dWxjIEdvZ29BcHBzIE5BU0E-.git
You can use already prepared scripts in /script
directory. To run the application call
./scripts/run.sh
and if you want to stop the container then execute
./scripts/stop.sh
Alternatively, you can build and run using your own docker commands i.e.:
docker image build -t url-collector -f ./deployment/url-collector.Dockerfile .
and
docker run -d -p 8080:8080 --name url-collector url-collector
If you want to reconfigure application you can use environment variables
docker run -e MY_VAR=MY_VALUE -d -p 8080:8080 --name url-collector url-collector
You can also run the application using source code calling
go run ./cmd/main/main.go
and if you want to reconfigure the application you can also provide the environment variables
MY_VAR=MY_VALUE go run ./cmd/main/main.go
or you can modify the config.yaml
file.
By default the server will start on http://localhost:8080/ and there you have one route available
- /api/v1/nasa/pictures
with two query params which allow to query for many urls from certain time
- from: defines start date in "2006-01-02" format
- to : defines end date in "2006-01-02" format
Example curl calls:
Gets todays picture url of the day
curl "http://localhost:8080/api/v1/nasa/pictures"
Gets all the pictures url from days 2023-01-01 to 2023-01-05
curl "http://localhost:8080/api/v1/nasa/pictures?from=2023-01-01&to=2023-01-05"