Skip to content

Instantly share code, notes, and snippets.

@klogic
Created March 30, 2020 22:51
Show Gist options
  • Save klogic/c9d1c16616459d6e72de27b958e050b6 to your computer and use it in GitHub Desktop.
Save klogic/c9d1c16616459d6e72de27b958e050b6 to your computer and use it in GitHub Desktop.
const axios = require("axios");
const getPosts = async url => {
return new Promise((resolve, reject) => {
axios
.get(url)
.then(result => resolve(result.data))
.catch(error => reject(error));
});
};
module.exports = { getPosts };
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment