javascript - 实验警告 : The http2 module is an experimental API

标签 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`)
})

我在控制台上收到这个警告

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

我在网上找不到相关说明是否可以在生产模式下使用?在出现此类警告的情况下,可以在生产模式下使用 HTTP/2 吗?

最佳答案

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

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

http2:

◦ The http2 module is no longer experimental. #22466

关于使其成为非实验性所涉及的所有工作的良好讨论:https://github.com/nodejs/node/issues/19453

关于javascript - 实验警告 : The http2 module is an experimental API,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52254893/

相关文章:

javascript - 如何使用 jQuery.getJSON 从本地主机上的 API 获取 JSON 数据

cURL 不适用于 nghttp2

node.js - 如何使用套接字将请求代理到 h2c HTTP/2 服务器?

azure - 如何在Azure中启用http2?

javascript - 每次我点击刷新时,倒计时器都会重新启动

javascript - 我试图在输入字段中显示地理位置 javascript 函数的结果

javascript - 所有上传完成后的 FineUploader 客户端事件

javascript - Pg-promise 性能提升 : Multiple inserts with multiple update parameters

javascript - VueJS : Displaying pie chart data value of each slices

javascript - 如何从数组创建多个 HTML 元素?