From ea91f085e0926a1cda1d3325165d551f907e7957 Mon Sep 17 00:00:00 2001 From: Daazd Date: Mon, 18 Mar 2024 14:00:17 -0700 Subject: [PATCH] changes --- index.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/index.js b/index.js index 5d6a968..824e429 100644 --- a/index.js +++ b/index.js @@ -1,4 +1,16 @@ require('dotenv').config(); + +async function getImage(query) { + const endpoint = `https://api.giphy.com/v1/gifs/search?api_key=${process.env.API_KEY}&q=dog&limit=25&offset=0&rating=g&lang=en&bundle=messaging_non_clips`; + const response = await fetch(endpoint); + const data = await response.json(); + const imageUrl = data.data[0].images.original.url; + console.log(imageUrl); + return imageUrl; +} + +getImage("dog"); // Print out value of API key stored in .env file + console.log(process.env.API_KEY) \ No newline at end of file