Get peer issue fixed
This commit is contained in:
parent
d6ca5440fa
commit
550e69568c
@ -76,7 +76,7 @@ app.use(function(req, res, next) {
|
||||
res.header('Access-Control-Allow-Origin', '*');
|
||||
res.header('Access-Control-Allow-Methods', 'GET,PUT,POST,DELETE,OPTIONS');
|
||||
res.header('Access-Control-Allow-Headers', 'Content-Type, Authorization, Content-Length, X-Requested-With, Accept, Authtoken,cookie_id');
|
||||
|
||||
|
||||
// intercept OPTIONS method
|
||||
if ('OPTIONS' == req.method) {
|
||||
return res.status(200).end();
|
||||
@ -87,7 +87,6 @@ app.use(function(req, res, next) {
|
||||
}
|
||||
);
|
||||
|
||||
app.use(errorMiddleware);
|
||||
app.use(bodyParser.json({ limit: "50mb" }));
|
||||
app.use(bodyParser.urlencoded({ extended: false }));
|
||||
app.use(
|
||||
@ -111,6 +110,7 @@ controllers.forEach(controller => {
|
||||
app.get("/epic_explorer/v1/**", (req, res) => {
|
||||
res.send({ msg: "Api works." });
|
||||
});
|
||||
app.use(errorMiddleware);
|
||||
|
||||
// * NOTE :: leave this as require() since this file is built Dynamically from webpack
|
||||
const { AppServerModuleNgFactory, LAZY_MODULE_MAP } = require("./server/main");
|
||||
|
@ -516,29 +516,35 @@ export class BlockchainKernelController {
|
||||
) => {
|
||||
var self = this;
|
||||
try {
|
||||
http.get('http://116.203.152.58:3413/v1/peers/connected', (resp) => {
|
||||
http.get('http://116.203.152.58:3413/v1/peers/connected',
|
||||
async (resp) => {
|
||||
// console.log('resp resp respresp',resp);
|
||||
let data = '';
|
||||
let result ;
|
||||
|
||||
// A chunk of data has been recieved.
|
||||
await new Promise((resolve) => {
|
||||
resp.on('data', function (chunk) {
|
||||
data += chunk;
|
||||
|
||||
let dataJson = self.IsJsonString(data);
|
||||
if(dataJson.length > 0){
|
||||
data += chunk;
|
||||
|
||||
dataJson.forEach(function (value, i) {
|
||||
value['id'] = i;
|
||||
});
|
||||
}
|
||||
response.status(200).json({
|
||||
status: 200,
|
||||
timestamp: Date.now(),
|
||||
message: 'Peers list fetched successfully',
|
||||
response: {
|
||||
dataJson
|
||||
},
|
||||
});
|
||||
let dataJson = self.IsJsonString(data);
|
||||
if(dataJson.length > 0){
|
||||
|
||||
result = dataJson.map(function (value, i) {
|
||||
value['id'] = i;
|
||||
return value;
|
||||
});
|
||||
}
|
||||
resolve();
|
||||
});
|
||||
});
|
||||
response.status(200).json({
|
||||
status: 200,
|
||||
timestamp: Date.now(),
|
||||
message: 'Peers list fetched successfully',
|
||||
response: {
|
||||
dataJson: result
|
||||
},
|
||||
});
|
||||
});
|
||||
} catch (error) {
|
||||
|
Loading…
Reference in New Issue
Block a user