代码之家  ›  专栏  ›  技术社区  ›  Guseyn Ismayylov

TypeError:“listener”参数必须是一个函数:http。createServer

  •  0
  • Guseyn Ismayylov  · 技术社区  · 7 年前

    当我试图使用 options 在里面 http.createServer :

    http.createServer({
      IncomingMessage: http.IncomingMessage,
      ServerResponse: http.ServerResponse
    }, (req, res) => {
     // use req, res
    });
    

    我得到一个错误: TypeError: "listener" argument must be a function . 这是节点的错误吗?

    0 回复  |  直到 7 年前
    推荐文章