matheus-lincon / advice-generator-app

HTML,CSS, JavaScript and API advice app from Front-End Mentor.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Frontend Mentor - Advice generator app solution

This is a solution to the Advice generator app challenge on Frontend Mentor. Frontend Mentor challenges help you improve your coding skills by building realistic projects.

Table of contents

Overview

The challenge

Users should be able to:

  • Generate a random advice by pressing a dice button

Screenshot


Links

My process

Built with

  • Semantic HTML5 markup
  • JavaScript
  • API Consuming
  • Flexbox
  • Position relative & absolute
  • Mobile-first workflow

What I learned

This advice app helped me to understand a little bit about how to consume API.

There are a lot of ways you can do it. In my case, to this project I used Axios CDN, you can see more here Axios.

Here some code:

<body>
  <script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>
</body>
const URL = 'https://api.adviceslip.com/'
function getAdvice() {
  axios
    .get(url)
    .then((response) => console.log(response)) // success!
    .catch((error) => console.log(error)) // error!
}

Useful resources

  • Advice Slip JSON API - This API helped me to make the app. It's pretty simple to use, no complications.

Author


About

HTML,CSS, JavaScript and API advice app from Front-End Mentor.

License:GNU General Public License v3.0


Languages

Language:CSS 49.2%Language:HTML 33.9%Language:JavaScript 17.0%