打开主菜单

“Nodejs/http/createServer”的版本间的差异

< Nodejs‎ | http
options
 
(未显示同一用户的1个中间版本)
第1行: 第1行:
 
+
用于创建服务。
 
http.createServer([options][, requestlistener])
 
http.createServer([options][, requestlistener])
  
 
==版本历史==
 
==版本历史==
 +
 
{| class="wikitable"
 
{| class="wikitable"
 
|版本||变更
 
|版本||变更
 +
|-
 +
|v10.15.3||小青青复制这篇文档所使用的版本。
 
|-
 
|-
 
|v9.6.0 || 现在支持options参数
 
|v9.6.0 || 现在支持options参数
第17行: 第20行:
  
 
===requestListener <Function>===
 
===requestListener <Function>===
 +
当触发[[Nodejs/http/Server/request|request事件]]时执行的函数。
 +
 
==返回值==
 
==返回值==
 
返回: <[[Nodejs/http/Server|http.Server]]>
 
返回: <[[Nodejs/http/Server|http.Server]]>

2019年5月27日 (一) 15:17的最新版本

用于创建服务。 http.createServer([options][, requestlistener])

目录

版本历史

版本 变更
v10.15.3 小青青复制这篇文档所使用的版本。
v9.6.0 现在支持options参数
v0.1.13 新增于: v0.1.13

参数

options <Object>

我也没用过这个参数。

  • IncomingMessage <http.IncomingMessage> 指定要使用的 IncomingMessage 类。用于扩展原始的 IncomingMessage。默认值: IncomingMessage。
  • ServerResponse <http.ServerResponse> 指定要使用的 ServerResponse 类。用于扩展原始 ServerResponse。默认值: ServerResponse。

requestListener <Function>

当触发request事件时执行的函数。

返回值

返回: <http.Server> 返回新建的 http.Server 实例。

备注

requestListener 是一个自动添加到 'request' 事件的函数。