controller : suseendhiran
This commit is contained in:
parent
c6344d53fa
commit
a2dac392ae
@ -31,7 +31,16 @@ exports.APIstatus = async (req, res) =>
|
||||
URL = object.url;
|
||||
request_object = object.requestObject;
|
||||
if (object.header == 1 && token_data.status == 200) { request_header = "Bearer"+" "+token_data.data.token; reqObj = {url: URL, method: object.method,json: true,body: request_object,headers : { 'Content-Type' : 'application/json' , 'Authorization' : request_header }} }
|
||||
else { reqObj = {url: URL,method: object.method,json: true,body: request_object} }
|
||||
else {
|
||||
if (object.name == "SMC Front End")
|
||||
{
|
||||
reqObj = {url: URL,method: object.method}
|
||||
}
|
||||
else
|
||||
{
|
||||
reqObj = {url: URL,method: object.method,json: true,body: request_object}
|
||||
}
|
||||
}
|
||||
request(reqObj, async function (error, response, body) {
|
||||
// because some times some api's could not send respond
|
||||
if (response == undefined)
|
||||
@ -98,7 +107,7 @@ exports.SingleApiStatus = async (req, res) =>
|
||||
URL = object.url;
|
||||
request_object = object.requestObject;
|
||||
if (object.header == 1 && token_data.status == 200) { request_header = "Bearer"+" "+token_data.data.token; reqObj = {url: URL, method: object.method,json: true,body: request_object,headers : { 'Content-Type' : 'application/json' , 'Authorization' : request_header }} }
|
||||
else { reqObj = {url: URL,method: object.method,json: true,body: request_object} }
|
||||
else { reqObj = {url: URL,method: object.method,body: request_object} }
|
||||
request(reqObj, function (error, response, body) {
|
||||
if (response == undefined)
|
||||
{
|
||||
@ -123,3 +132,24 @@ exports.SingleApiStatus = async (req, res) =>
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
exports.test = async (req, res) =>
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
reqObj = {url: "https://demo.devopsmcfinance.com/mw/cet/main" ,method: "GET",json: true,body: "request_object"}
|
||||
request(reqObj, function (error, response, body) {
|
||||
console.log(response.statusCode);
|
||||
})
|
||||
}
|
||||
catch(err)
|
||||
{
|
||||
res.send({'status':404,
|
||||
message: err.message || "Some error occurred while inserting statements." ,'data': "No data"
|
||||
});
|
||||
} //end of try catch
|
||||
|
||||
};
|
||||
@ -13,7 +13,7 @@ module.exports = app => {
|
||||
// Single Api status check Api
|
||||
router.post("/SingleApiStatus", Mycontroller.SingleApiStatus);
|
||||
|
||||
|
||||
router.get("/test", Mycontroller.test);
|
||||
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user