Skip to content

Commit

Permalink
Create index.js
Browse files Browse the repository at this point in the history
Signed-off-by: SkandaBT <[email protected]>
  • Loading branch information
skanda890 authored Oct 16, 2024
1 parent 70dd660 commit 290bc96
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions riddle-generator/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
require('dotenv').config();

Check failure on line 1 in riddle-generator/index.js

View check run for this annotation

Codeac.io / Codeac Code Quality

Parsing error: No Babel config file detected for /tmp/commit-1277125-eslint/riddle-generator/index.js. Either disable config file checking with requireConfigFile: false, or configure Babel so that it can find the config files.
const axios = require('axios');

const apiKey = process.env.API_KEY;
const url = `https://api.google.com/gemini/v1/riddles?apikey=${apiKey}`;

axios.get(url)
.then(response => {
const riddle = response.data.riddle;
console.log(`Here's a riddle for you: ${riddle}`);
})
.catch(error => {
console.error('Error generating the riddle:', error);
});

0 comments on commit 290bc96

Please sign in to comment.