我在AWS EC2中使用Cherrypy开发了一个Web应用程序,运行此应用程序时,我可以使用localhost在本地Web浏览器中看到它,但使用系统IP地址我无法访问该站点。任何人都可以指导我如何使用托管应用程序,以便可以在AWS EC2计算机外部的Internet上访问它。
我使用了以下配置。
gatherDataToSync: async (connection, recordId) => {
self.recordIdsUsed.push(recordId);
//minor improvement maybe, you can do these 2 things in parallel
let [objectId,objectData] = await Promise.all(
referenceHelper.getObjectIdForRecordId(connection, recordId),
self.getRelatedObjectsInformation(connection, recordId)
);
self.objectCollection.push({
"recordId": recordId,
"objectId": objectId,
objectData
});
if (referenceHelper.includes(self.objectListToStopExecutionAt, objectId) === false) {
//you return a recursive promise here so you can await calling gatherDataToSync
return Promise.all(
//no need for if statement and for loop, just take out all items you don't need
(objectData['relationships'] || [])//no need for if null
.filter(//filter out the ones you don't need
item =>
referenceHelper.includes(self.relationshipsToIgnore, item) !== false
)
.map(
item =>
(item['relationships'] || [])//no need for inner if null
.filter(//filter out the ones you don't need
item =>
referenceHelper.includes(self.recordIdsUsed, item) !== false
)
)
.map(
item =>//this is an array of array of objectIds
Promise.all(//create a promise with recursive promises
item.map(
item=>self.gatherDataToSync(connection, item)
)
)
)
);
}
}