New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

http2-hooks

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

http2-hooks

Helper functions for making an http2 server.

latest
Source
npmnpm
Version
1.0.0
Version published
Maintainers
1
Created
Source

http2-hooks

yarn add http2-hooks

Build an HTTP/2 server is simple as this:

import http2 from 'http2';
import path from 'path';
import fs from 'fs';
import mime from 'mime-types';
import { useHttp2Server, ConsoleMiddlewareHttp2Hook, RouterHttp2Hook, RouterFactory } from 'http2-hooks';

const server = http2.createSecureServer({...});
useHttp2Server(server, [
    new ConsoleMiddlewareHttp2Hook(),
    new RouterHttp2Hook(
        new RouterFactory().get("/:static*", (stream, headers) => {
            const staticPath = path.resolve(__dirname, './static');
            const fullPath = path.join(staticPath, headers[':path'] as string);
            fs.createReadStream(fullPath).pipe(stream).respond({ 'content-type': mime.lookup(fullPath) as string });
        }))
]).listen(443);

Keywords

http2

FAQs

Package last updated on 03 Jan 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts