Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/xcode/7.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Node.js 使用Node/Express JS进行批处理请求_Node.js_Express - Fatal编程技术网

Node.js 使用Node/Express JS进行批处理请求

Node.js 使用Node/Express JS进行批处理请求,node.js,express,Node.js,Express,我有一个端点/myEndpoint,需要在这里处理批处理请求 例如,假设我有一个包含1000多个URL的数组 const URLs = ['/url1','/url2','/url3', '/url4','/url5','/url6', '/url7','/url8','/url9', '/url10','/url11','/url12', ...] 对于每个url,我需要执行一个“POST”请求,但我想确保在我的expressJS函数(/myEndpoint)终止之前,所有请求都已被触发,因

我有一个端点
/myEndpoint
,需要在这里处理批处理请求

例如,假设我有一个包含1000多个URL的数组

const URLs = ['/url1','/url2','/url3',
'/url4','/url5','/url6',
'/url7','/url8','/url9',
'/url10','/url11','/url12',
...]
对于每个url,我需要执行一个“POST”请求,但我想确保在我的expressJS函数(
/myEndpoint
)终止之前,所有请求都已被触发,因为我知道我在一个无服务器的环境中


那么,哪种方法是最好的呢?

您的端点正在侦听这些URL吗?(例如/myEnpoint/:xxx)或者它们是相关的?或者URL是myEndpoint调用的有效负载中的URL?您关心请求的结果吗,还是只想触发并忘记?