Giter VIP home page Giter VIP logo

vitalipri / space-snapshots Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 6 KB

The SpaceSnapshot is a web application that allows users to view and save images from NASA's Astronomy Picture of the Day (APOD) API. The application is built using HTML, CSS, and JavaScript, and it leverages the Fetch API to communicate with the NASA API.

Home Page: https://spacesnapshots.vercel.app

HTML 19.58% JavaScript 56.04% CSS 24.38%
loaf localstorage nasa-api

space-snapshots's Introduction

SpaceSnapshots

The SpaceSnapshot is a web application that allows users to view and save images from NASA's Astronomy Picture of the Day (APOD) API. The application is built using HTML, CSS, and JavaScript, and it leverages the Fetch API to communicate with the NASA API.

Key Features

  • View NASA Images: Users can view images from NASA's APOD API. The application fetches the latest 10 images from the API and displays them in a grid format.

  • Save Favorites: Users can save their favorite images by clicking the "Add to Favorites" button. The application stores the favorites in the browser's local storage, allowing users to access their saved images even after closing the browser.

  • Remove Favorites: Users can remove images from their favorites by clicking the "Remove Favorites" button. The application updates the local storage and removes the image from the favorites list.

  • Responsive Design: The application is designed to be responsive and works well on both desktop and mobile devices.

How It Works

  1. Fetch NASA Images: When the application loads, it fetches the latest 10 images from the NASA APOD API using the Fetch API. The images are stored in the resultsArray variable.

  2. Display Images: The createDOMNodes function creates HTML elements for each image in the resultsArray and appends them to the imagesContainer element. Each image is displayed as a card with a title, image, and description.

  3. Save Favorites: When a user clicks the "Add to Favorites" button, the saveFavorite function is called. This function checks if the image is already in the favorites object and adds it if it's not. It then updates the local storage and displays a confirmation message.

  4. Remove Favorites: When a user clicks the "Remove Favorites" button, the removeFavorite function is called. This function removes the image from the favorites object, updates the local storage, and updates the DOM to reflect the change.

Conclusion

The NASA Picture Viewer is a simple yet powerful web application that allows users to view and save images from NASA's APOD API. It demonstrates how to use the Fetch API to communicate with an external API, how to store data in the browser's local storage, and how to create a responsive user interface. The application is a great starting point for anyone interested in building web applications that interact with external APIs.

cosmicCaptures.webm

space-snapshots's People

Contributors

vitalipri avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.