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

Ank*_*oni 3 javascript node.js http2

我在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`)
})
Run Code Online (Sandbox Code Playgroud)

我在控制台上收到此警告

(node:16600) ExperimentalWarning: The http2 module is an experimental API.
Run Code Online (Sandbox Code Playgroud)

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

Bar*_*ard 6

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

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

http2

?http2模块不再处于实验阶段。#22466

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