https://github.com/lamba01/advice-generator-app
A test of my API integrations knowledge. This is an advice generator from an API using the JavaScript fetch function.
https://github.com/lamba01/advice-generator-app
api apiintegration fetch-api javascript json-api
Last synced: 4 days ago
JSON representation
A test of my API integrations knowledge. This is an advice generator from an API using the JavaScript fetch function.
- Host: GitHub
- URL: https://github.com/lamba01/advice-generator-app
- Owner: lamba01
- Created: 2023-06-02T16:33:34.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2023-07-03T20:34:52.000Z (almost 2 years ago)
- Last Synced: 2025-03-05T09:48:02.563Z (4 months ago)
- Topics: api, apiintegration, fetch-api, javascript, json-api
- Language: CSS
- Homepage: https://adviceegeneratorapp.netlify.app/
- Size: 48.8 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Advice-Generator-App
# Frontend Mentor - Advice generator app solutionThis is a solution to the [Advice generator app challenge on Frontend Mentor](https://www.frontendmentor.io/challenges/advice-generator-app-QdUG-13db). Frontend Mentor challenges help you improve your coding skills by building realistic projects.
## Table of contents
- [Overview](#overview)
- [The challenge](#the-challenge)
- [Screenshot](#screenshot)
- [Links](#links)
- [My process](#my-process)
- [Built with](#built-with)
- [What I learned](#what-i-learned)
- [Continued development](#continued-development)
- [Useful resources](#useful-resources)
- [Author](#author)
- [Acknowledgments](#acknowledgments)## Overview
### The challenge
Users should be able to:
- View the optimal layout for the app depending on their device's screen size
- See hover states for all interactive elements on the page
- Generate a new piece of advice by clicking the dice icon### Screenshot

### Links
- Solution URL: [Solution](https://github.com/lamba01/Advice-Generator-App)
- Live Site URL: [Live Site](https://adviceegeneratorapp.netlify.app/)## My process
### Built with
- Semantic HTML5 markup
- CSS custom properties
- Flexbox
- Data from API### What I learned
```js
function fetchNewAdvice() {
fetch("https://api.adviceslip.com/advice")
.then((response) => response.json())
.then((data) => {
const advice = data.slip.advice;
contentElement.textContent = "\"" + advice + "\"";
const id = data.slip.id;
slipid.textContent = "advice #" + id
})
.catch((error) => {
console.log("Error fetching data:", error);
});
}
```### Continued development
This is my first project using API data and it is only a newbie level challenge. I hope to take on harder and more complex projects using APIs before I begin my react tutorial for solid background
## Author
- Frontend Mentor - [@lamba01](https://www.frontendmentor.io/profile/lamba01)
- Twitter - [@lambacodes](https://www.twitter.com/lambacodes)## Acknowledgments
I thank myself for not giving up despite the difficulties learning from Nigeria.