Back | Home
الـ Path الحالي: /home/picotech/domains/instantly.picotech.app/public_html/public/uploads/../uploads/../../../../instantly.picotech.app/homes/../../wa.picotech.app/public_html/node_modules/path-exists/../duplexify/./.././debug/../node-wav/../domhandler/../tslib/.././engine.io-parser/../debug/../safer-buffer/../vary/./../pngjs/coverage/../../ipaddr.js/./../encodeurl/../long/../..
الملفات الموجودة في هذا الـ Path:
.
..
.env
env.js
node_modules
package-lock.json
package.json
request.js
routes.js
routes.zip
server.js
sessions
wa.zip
waserver.js
worker.log
مشاهدة ملف: request.js
const axios = require('axios');
const whitelistedServers=process.env.CLIENT_HOST.split(",");
const request = (method, url, data) => {
let promises = [];
method = method.toLowerCase();
if (!["get", "post"].includes(method)) {
return Promise.reject(new Error("Invalid HTTP method"));
}
if (method == 'get') {
data = { params: data }
} else {
axios.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded';
}
for (i = 0; i < whitelistedServers.length; i++) {
axios.defaults.baseURL = whitelistedServers[i] + '/api';
promises.push(axios[method](url, data));
}
return Promise.all(promises).then(() => console.log('all done'));
}
module.exports = { request }