Giter Site home page Giter Site logo

asynchronous-programming-implementation's Introduction

Asynchronous programming exercise

We will be working with Promises and the async/await functionality to do some asynchronous programming.

Setup.

  1. Create a new directory called async-implementation and move into it.
  2. Run npm init -y in order to initialize a new node project
  3. Run npm install axios in order to install axios as a dependency
  4. Create an index.js file.
  5. Require axios into the index.js file

Objectives

  1. Create an async function named fetchPeople that performs a GET request using axios to https://goodparts.dokku-hosted.thruhere.net/people using await
  2. Save the data returned from this function call into a variable. (Remember that the actual data returned from an axios request is stored in the data property of the response object). The data you receive will be a group of person objects in an array
  3. If you have less than 200 elements in the array perform the same operation again, and add all the newly fetched elements to the array. You will need to iterate over the newly retrieved array in order to push the elements into the previously created array.
  4. Return this array from the fetchPeople function and assign it to a variable
  5. Since fetchPeople is an async/await function it will always return a promise, write down a promise handler that will iterate over the returned array and will console.log each element inside the array

asynchronous-programming-implementation's People

Contributors

delaguardiap avatar

Watchers

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