Node.js应用程序-网络模块未连接并卡住加载

时间:2019-01-10 16:27:24

标签: node.js express

我是nodejs的新手,他正在构建一个应用程序来检查有效的电子邮件地址。

该代码在localhost中工作正常,但是当我将其上传到服务器(带有nginx代理的AWS)时,该应用程序有时会起作用,当我多次访问url时,它就会卡在加载中。

我正在使用net模块。在conn.on('data',data => {。以下是我的代码:

pre_or_post_matches <- function(vec){
  # get length of `vec`, create empty return vector `out` that we fill
  len <- length(vec)
  out <- rep(NA, len)
  # first element: just check if it equals the second 
  out[1] <- vec[1]==vec[2]
  # last element: just check if it equals the second to last 
  out[len] <- vec[len]==vec[len-1]
  # the other elements: check if equal to at least one neighbor 
  for (idx in 2:(len-1)){
    out[idx] <- (vec[idx]==vec[idx-1]) | (vec[idx]==vec[idx+1])
  }
  return(out)
}


# apply func to example data provided by OP 
x <- c(1, 1, 2, 1, 3, 3)

pre_or_post_matches(x)
## [1]  TRUE  TRUE FALSE FALSE  TRUE  TRUE

0 个答案:

没有答案