Skip to content

About

No description, website, or topics provided.

Resources

Stars

2 stars

Watchers

0 watching

Forks

 
 

Repository files navigation

Astronomy Picture of the Day (APOD)

This API is a Gradle project using Nasa's APOD API.

Table of contents

  1. Getting Started
  2. Docs
  3. Author

Getting started

  1. Clone the project
git clone https://github.com/G1TS23/Apod.git
  1. cd into the new directory
cd apod
  1. Rename application.properties.example (in /src/main/resources/) to application.properties

  2. Replace information in application.properties such as :

  • Your Database information
5 # Database
6 spring.datasource.url=jdbc:mysql://localhost:3306/apod
7 spring.datasource.username=REPLACE_WITHI_YOUR_DB_USERNAME
8 spring.datasource.password=REPLACE_WITHI_YOUR_DB_PASSWORD
  • Your own JWT Secret
24 # Security
25 jwt.secret=REPLACE_WITH_YOUR_OWN_JWT_SECRET
41 #API
42 api.url=https://api.nasa.gov/planetary/apod
43 api.key=REPLACE_WITH_YOUR_OWN_API_KEY
  1. Run your mysql server and create a schema named apod

  2. Run the application

Docs

Roles

There's three different roles :

  • ADMIN has access to a simple CRUD for stored Apod
  • USER can call two endpoints that bounce to Nasa's API :
    • /api : the picture of day
    • /api/range?from=2025-02-01&to=2025-02-03 : pictures or videos within a time range)
  • SCRAPPER has almost the same endpoints but that stores object in database :
    • /api/scrap/today
    • /api/scrap/range?from=2025-02-11&to=2025-02-14

API collection

In root directory there's a collection Apod_Bruno_Collection.json you can import in Bruno or Postman to test the API. In order to store the userToken after login you to have to add this post-request script :

  • Bruno :
var jsonData = res.getBody();
bru.setEnvVar("userToken", jsonData.token);
  • Postman :
var jsonData = pm.response.json();
pm.environment.set("userToken", jsonData.token);

In the collection properties create an environment variable called userToken.

Folders
  • API : only for user role, bounce request from NASA's API
  • CRUD : only for admin role, manipulate database
  • SCRAP : only for scrapper role, retrieve data from NASA's API and store it in database
  • USER : log in, register, view credentials and log out

Author

About

No description, website, or topics provided.

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages