ggez-banking-sdk
Version:
A Node.js package to handle GGEZ Banking API endpoints, Simplify the process of managing CRUD operations with this efficient and easy-to-use package.
33 lines (32 loc) • 1.06 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const axios_1 = __importDefault(require("axios"));
class ApiService {
constructor() {
this.bearer = (token) => {
return `bearer ${token}`;
};
this.restApi = async (baseURL, method, endpoint, headers, data, params) => {
const config = {
method: method,
url: `${baseURL}/${endpoint}`,
params: params,
headers: headers,
data: data,
};
try {
const response = await (0, axios_1.default)(config);
return response;
}
catch (error) {
console.error("Error making GET request:", error);
throw error;
}
};
}
}
const RestApiService = new ApiService();
exports.default = RestApiService;