Wix
Occult API से अपनी Wix साइट में ज्योतिष फ़ीचर जोड़ें।
Velo by Wix
बैकएंड कोड से API को कॉल करने के लिए Velo (Wix का डेवलपमेंट प्लेटफ़ॉर्म) इस्तेमाल करें।
बैकएंड स्क्रिप्ट
Velo की एक बैकएंड स्क्रिप्ट:
import { fetch } from 'wix-fetch';
export async function getHoroscope(sign) {
const apiKey = environment['OCCULT_API_KEY'];
const response = await fetch('https://api.occultapi.com/api/astro/rashifal/daily/', {
method: 'POST',
headers: {
'X-API-Key': apiKey,
'Content-Type': 'application/json',
},
body: JSON.stringify({ rashi: sign }),
});
return response.json();
}फ़्रंटएंड
नतीजा दिखाने के लिए dataset या custom element इस्तेमाल करें।
ध्यान दें
API कुंजी कभी फ़्रंटएंड कोड में न रखें; Velo के बैकएंड फ़ंक्शन इस्तेमाल करें।