GithubHelp home page GithubHelp logo

viniciusshenri96 / advice-generator-app Goto Github PK

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

I used async/awai, and fetch() to be able to generate advice through the adviceslip API and generated an error message if the promise is not resolved with cath()

HTML 28.39% CSS 56.19% JavaScript 15.43%
adviceslip-api api css html

advice-generator-app's Introduction

Advice generator app

ย 

๐Ÿšง Advice generator app ๐ŸŸข Completed ๐Ÿš€ ๐Ÿšง

ย 

Project description ๐Ÿ“š

This is a solution to the challenge Advice generator app.

This is a challenge on the Mentor frontend site, where I was able to put my knowledge of async/await into practice.

Challenge Difficulty - JUNIOR

ย 

What I learned

I used async/awai, and fetch() to be able to generate advice through the adviceslip API and generated an error message if the promise is not resolved with cath()

API: https://api.adviceslip.com/advice

try {
  const res = await fetch("https://api.adviceslip.com/advice");
  const data = await res.json();
  adviceText.innerText = `โ€œ${data.slip.advice}โ€`;
  adviceID.innerText = data.slip.id;
} catch (err) {
  console.error(new Error("It is not an internet connection"));
}

Animated blackground with Vanta.js:

HTML:

...
<div id="vanta"></div>
...

<script src="https://cdnjs.cloudflare.com/ajax/libs/three.js/r134/three.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/vanta@latest/dist/vanta.globe.min.js"></script>

JS:

window.addEventListener("DOMContentLoaded", () => {
  VANTA.GLOBE({
    el: "#vanta",
    mouseControls: true,
    touchControls: true,
    gyroControls: false,
    minHeight: 200.0,
    minWidth: 200.0,
    scale: 1.0,
    scaleMobile: 1.0,
    color: 0x3fff8e,
  });
});

Links

My process

Built with

๐Ÿ‘จโ€๐Ÿ’ป Author

advice-generator-app's People

Contributors

viniciusshenri96 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.