Search code examples
javascriptnode.jshttp2

ExperimentalWarning: The http2 module is an experimental API


I am using HAPI JS with HTTP/2 in Node JS 10.9. When I start the server using this example,

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

I get this warning on the console

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

I cannot find a relevant explanation on the internet that whether we can use it on Production Mode? Is it ok to use HTTP/2 on Production Mode with such warning?


Solution

  • As @DoMiNeLa10 noted the experimental warning was dropped in 10.10:

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

    http2:

    ◦ The http2 module is no longer experimental. #22466

    Good discussion here as to all the work involved in making it non-experimental: https://github.com/nodejs/node/issues/19453