express-h2
TypeScript icon, indicating that this package has built-in type declarations

1.4.3 • Public • Published

express-h2

NPM Version NPM Downloads Coverage Status Dependecies

Native http2 framework compatible with express routes

NPM

Usage

Assuming that exists a express route function defined (example below)

Express Routes

//routes.js
//const usersRoutes = require('./users.routes');
export (app)=>{
    app.get('/test', (req, res)=>{
        res.json('test route is working!')
    })
    // app.use('/users/', usersRoutes)
}

Now you can use this function to handle your routes with http2 protocol

Using secure server

You need to pass the secure options

const http2 = require('express-h2')
const expressRoutes = require('./routes')
const fs = require('fs');

const secureOptions = {
  key: fs.readFileSync('server-key.pem'),
  cert: fs.readFileSync('server-cert.pem')
};

const server = http2.createSecureServer(secureOptions, expressRoutes)
server.listen(3443)

For more informations and issues you can see in the oficial repository or read this article with example project

Configuration Options

const options = {}
http2.createSecureServer(secureOptions, expressRoutes, options)

License

MIT License

Authors

Kissema Eduardo Rafael (kissema1@gmail.com)

Sponsored By

K SOLID

Package Sidebar

Install

npm i express-h2

Weekly Downloads

0

Version

1.4.3

License

MIT

Unpacked Size

12.6 kB

Total Files

13

Last publish

Collaborators

  • kissema