JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 19
  • Score
    100M100P100Q44282F
  • License MIT

express router using the native nodejs http2 protocol

Package Exports

  • express-h2

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (express-h2) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Express-h2

NPM Version NPM Downloads

A simple way for use http2 protocol with express framework

How to install

using npm

npm i express-h2

or using yarn

yarn add express-h2

How to use

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

Express Routes

//routes.js
import { Application } from 'express';
export (app : Application)=>{
    app.get('/test', (req, res)=>{
        res.json('test route is working!')
    })
    app.use('separated_file.routes.js')
}

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

Configuration Options

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

License

MIT License

Authors

Kissema Eduardo Rafael (kissema1@gmail.com)