繁体   English   中英

实验警告:http2模块是实验API

[英]ExperimentalWarning: The http2 module is an experimental API

我在Node JS 10.9中将HAPI JS与HTTP / 2一起使用。 当我使用此示例启动服务器时,

const fs = require('fs')
const Hapi = require('hapi')
const http2 = require('http2')

const server = new Hapi.Server()
server.connection({
 listener: http2.createServer(),
 host: 'localhost',
 port: 3000
})

server.route({
 method: 'GET',
 path:'/hello',
 handler: function (request, reply) {
   return reply('Hello, World!')
 }
})

server.start((err) => {
 if (err) console.error(err)
 console.log(`Started ${server.connections.length} connections`)
})

我在控制台上收到此警告

(node:16600) ExperimentalWarning: The http2 module is an experimental API.

我无法在互联网上找到有关是否可以在生产模式下使用它的相关解释? 可以在生产模式下将HTTP / 2与此类警告一起使用吗?

正如@ DoMiNeLa10指出的,实验警告已在10.10中删除:

https://github.com/nodejs/node/pull/22716

http2

◦http2模块不再处于实验状态。 #22466

关于使其成为非实验性的所有工作,这里进行了很好的讨论: https : //github.com/nodejs/node/issues/19453

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM