@geniucode/common-utils
Version:
Common utils
24 lines • 1.12 kB
JavaScript
const { __axios } = require('@geniucode/multi-axios');
import { logi } from '../logger';
const logger = logi(__filename);
export const instagramGetterAxiosInstance = () => {
if (!process.env.IG_GETTER_RAPID_BASE_URL) {
logger.error('Error | IG_GETTER_RAPID_BASE_URL must be defined');
throw new Error('IG_GETTER_RAPID_BASE_URL must be defined');
}
if (!process.env.IG_GETTER_RAPID_HEADER_KEY) {
logger.error('Error | IG_GETTER_RAPID_HEADER_KEY must be defined');
throw new Error('IG_GETTER_RAPID_HEADER_KEY must be defined');
}
if (!process.env.IG_GETTER_RAPID_HEADER_HOST) {
logger.error('Error | IG_GETTER_RAPID_HEADER_HOST must be defined');
throw new Error('IG_GETTER_RAPID_HEADER_HOST must be defined');
}
const axios = __axios(process.env.IG_GETTER_RAPID_BASE_URL, {
'Content-Type': 'application/json',
'X-RapidAPI-Key': process.env.IG_GETTER_RAPID_HEADER_KEY,
'X-RapidAPI-Host': process.env.IG_GETTER_RAPID_HEADER_HOST,
}).init();
return axios;
};
//# sourceMappingURL=instagram-getter-axios-instance.js.map