-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapi.js
More file actions
20 lines (20 loc) · 696 Bytes
/
api.js
File metadata and controls
20 lines (20 loc) · 696 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.getRandomQuote = void 0;
const axios_1 = __importDefault(require("axios"));
const dotenv_1 = __importDefault(require("dotenv"));
dotenv_1.default.config();
const getRandomQuote = async () => {
try {
const response = await axios_1.default.get("https://zenquotes.io/api/random");
return response.data;
}
catch (error) {
console.error("Error fetching quote:", error);
throw error;
}
};
exports.getRandomQuote = getRandomQuote;